..
This commit is contained in:
60
generate_final_vectors.py
Normal file
60
generate_final_vectors.py
Normal file
@@ -0,0 +1,60 @@
|
||||
import os
|
||||
|
||||
output_dir = r's:\Source\Android\DaydreamClock\app\src\main\res\drawable'
|
||||
|
||||
# Path Data provided by user
|
||||
# Viewport is 24x24 based on the path coordinates (M12,4...)
|
||||
paths = {
|
||||
"num_0": "M12,4c-4.4,0 -8,3.6 -8,8s3.6,8 8,8s8,-3.6 8,-8S16.4,4 12,4zM12,6c3.3,0 6,2.7 6,6s-2.7,6 -6,6s-6,-2.7 -6,-6S8.7,6 12,6z",
|
||||
"num_1": "M10,4v2h2v14h-2v2h6v-2h-2V4H10z", # Using simple version
|
||||
"num_2": "M12,4c-3.3,0 -6,2.7 -6,6h2c0,-2.2 1.8,-4 4,-4s4,1.8 4,4c0,2 -1.5,3.5 -3.5,5.5L6,20v2h12v-2H8.8l5.7,-5.7C17.1,11.7 18,9.8 18,8C18,5.8 15.3,4 12,4z",
|
||||
"num_3": "M12,4c-3.3,0 -6,2.7 -6,6h2c0,-2.2 1.8,-4 4,-4s4,1.8 4,4c0,1.7 -1.1,3.1 -2.6,3.7v0.6C14.9,14.9 16,16.3 16,18c0,2.2 -1.8,4 -4,4s-4,-1.8 -4,-4H6c0,3.3 2.7,6 6,6s6,-2.7 6,-6c0,-2.4 -1.5,-4.5 -3.7,-5.5C16.5,12.5 18,10.4 18,8C18,5.8 15.3,4 12,4z",
|
||||
"num_4": "M14,4h-2L6,14v2h8v4h2v-4h4v-2h-4V4zM14,14H8.8L14,5.3V14z",
|
||||
"num_5": "M6,4v8h2c0,-2.2 1.8,-4 4,-4s4,1.8 4,4s-1.8,4 -4,4c-2.2,0 -4,-1.8 -4,-4H6c0,3.3 2.7,6 6,6s6,-2.7 6,-6c0,-3.3 -2.7,-6 -6,-6H8V6h10V4H6z",
|
||||
"num_6": "M12,4c-4.4,0 -8,3.6 -8,8s3.6,8 8,8s8,-3.6 8,-8h-2c0,3.3 -2.7,6 -6,6s-6,-2.7 -6,-6s2.7,-6 6,-6c1.9,0 3.6,0.9 4.7,2.3L18.9,6.9C17.2,5.1 14.7,4 12,4zM12,10c-2.2,0 -4,1.8 -4,4s1.8,4 4,4s4,-1.8 4,-4S14.2,10 12,10z",
|
||||
"num_7": "M6,4v2h10l-6,14h2.3l6,-14V4H6z",
|
||||
"num_8": "M12,4c-3.3,0 -6,2.7 -6,6c0,1.8 0.8,3.4 2.1,4.5C6.8,15.6 6,17.2 6,19c0,3.3 2.7,6 6,6s6,-2.7 6,-6c0,-1.8 -0.8,-3.4 -2.1,-4.5C17.2,13.4 18,11.8 18,10C18,6.7 15.3,4 12,4zM12,6c2.2,0 4,1.8 4,4s-1.8,4 -4,4s-4,-1.8 -4,-4S9.8,6 12,6zM12,17c2.2,0 4,1.8 4,4s-1.8,4 -4,4s-4,-1.8 -4,-4S9.8,17 12,17z",
|
||||
"num_9": "M12,4c-3.3,0 -6,2.7 -6,6h2c0,-2.2 1.8,-4 4,-4s4,1.8 4,4s-1.8,4 -4,4c-1.9,0 -3.6,-0.9 -4.7,-2.3L6.1,13.1C7.8,14.9 10.3,16 13,16c3.3,0 6,-2.7 6,-6S15.3,4 12,4zM12,6c2.2,0 4,1.8 4,4s-1.8,4 -4,4s-4,-1.8 -4,-4S9.8,6 12,6z",
|
||||
"num_colon": "M12,6a1.5,1.5 0,1 0,0 3a1.5,1.5 0,1 0,0 -3zM12,15a1.5,1.5 0,1 0,0 3a1.5,1.5 0,1 0,0 -3z"
|
||||
}
|
||||
|
||||
def create_xml(name, path):
|
||||
# Colors:
|
||||
# Top: #E629B6F6 (Light Blue 400 approx, 90% opacity)
|
||||
# Bottom: #E60097A7 (Cyan 700 approx, 90% opacity)
|
||||
# To match user's purple-ish hints or the reference:
|
||||
# Reference shows Blue -> Cyan/Light Blue.
|
||||
# Let's start with a vibrant Sky Blue to darker Ocean Blue for depth if we assume a dark background.
|
||||
# Or Blue to Purple.
|
||||
# User example: #B30077FF (Purple-Blue) and #9933CCFF (Purple)
|
||||
# Let's make the gradients slightly different for fun or uniform?
|
||||
# Uniform "Gel" look works best.
|
||||
# Let's try: Top = #CC 4FC3F7 (Light Blue), Bottom = #CC 2962FF (Blue)
|
||||
|
||||
xml = f'''<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="200dp"
|
||||
android:height="200dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="{path}">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:startY="0"
|
||||
android:startX="12"
|
||||
android:endY="24"
|
||||
android:endX="12"
|
||||
android:type="linear">
|
||||
<item android:offset="0.0" android:color="#E64FC3F7"/>
|
||||
<item android:offset="1.0" android:color="#E62962FF"/>
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
</vector>'''
|
||||
return xml
|
||||
|
||||
for name, path in paths.items():
|
||||
with open(os.path.join(output_dir, name + ".xml"), "w") as f:
|
||||
f.write(create_xml(name, path))
|
||||
print(f"Generated {name}.xml")
|
||||
Reference in New Issue
Block a user