"""Regenerate every app icon / splash asset from one definition.
Source: the "A ยท Skyline" concept on the claude.ai design canvas (Icons.dc.html).
After changing the shapes below, run (from the repo root):
python3 assets/branding/make_icons.py
dart run flutter_launcher_icons
dart run flutter_native_splash:create
The web UI draws the same icon in wasm/frontend/src/components/AppIcon.jsx;
keep EDGE / WINDOW there in sync.
"""
import os
import re
import subprocess
HERE = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.dirname(os.path.dirname(HERE))
CHROME = '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
# Horizon line between the left run-in (y = 70) and the right run-out (y = 63):
# house roof with chimney, then a tall and a small fir tree.
EDGE = ('L8 70 L8 56 L21 44 L27 49.5 L27 43 L30.5 43 L30.5 52.8 L34 56 L34 70 L46 70 '
'L50 66 L59 56 L54 56 L62 44 L58 44 L66 28 L74 44 L70 44 L78 56 L73 56 L82 66 '
'L85 66 L89 58 L87 58 L92 48 L97 58 L95 58')
LEFT_Y, RIGHT_Y = 70, 63
STARS = (''
'')
WINDOW = ''
LINE = 'fill="none" stroke="#F5B544" stroke-width="4" stroke-linejoin="round" stroke-linecap="round"'
def rounded():
"""Rounded tile: web favicon, splash, in-app icon."""
return (f'\n')
def square():
"""Full-bleed square for iOS / store icons (the OS applies the corner mask)."""
return (f'\n')
def foreground():
"""Android adaptive foreground (background #0E1424): artwork in the middle 2/3 so
round launcher masks keep the house; ground and line run out to the border."""
return (f'\n')
def splash12(size=1152, icon=520):
"""Android 12+ splash: the rounded icon inside the 768 px safe circle."""
inner = re.search(r'', rounded(), re.S).group(1)
off = (size - icon) / 2
return (f'\n')
def write(name, text):
with open(os.path.join(HERE, name), 'w') as f:
f.write(text)
def render(svg, px, png):
subprocess.run([CHROME, '--headless=new', '--disable-gpu', '--hide-scrollbars',
'--default-background-color=00000000', f'--window-size={px},{px}',
f'--screenshot={os.path.join(HERE, png)}', 'file://' + os.path.join(HERE, svg)],
check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
write('icon.svg', rounded())
write('icon-square.svg', square())
write('icon-foreground.svg', foreground())
write('splash-android12.svg', splash12())
render('icon-square.svg', 1024, 'icon-1024.png')
render('icon-foreground.svg', 1024, 'icon-foreground-1024.png')
render('icon.svg', 384, 'splash-logo.png')
render('splash-android12.svg', 1152, 'splash-android12.png')
public = os.path.join(ROOT, 'wasm', 'frontend', 'public')
write(os.path.join(public, 'favicon.svg'), rounded())
subprocess.run(['sips', '-Z', '180', os.path.join(HERE, 'icon-1024.png'),
'--out', os.path.join(public, 'apple-touch-icon.png')], check=True, stdout=subprocess.DEVNULL)
print('icons written to', HERE, 'and', public)