diff --git a/assets/icon-src/background.svg b/assets/icon-src/background.svg new file mode 100644 index 0000000..2560610 --- /dev/null +++ b/assets/icon-src/background.svg @@ -0,0 +1 @@ + diff --git a/assets/icon-src/foreground.svg b/assets/icon-src/foreground.svg new file mode 100644 index 0000000..5bae1ca --- /dev/null +++ b/assets/icon-src/foreground.svg @@ -0,0 +1 @@ + diff --git a/assets/icon-src/glyph.svg b/assets/icon-src/glyph.svg deleted file mode 100644 index cbdeb64..0000000 --- a/assets/icon-src/glyph.svg +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - diff --git a/assets/icon-src/icon.svg b/assets/icon-src/icon.svg index adf7fc8..bb88325 100644 --- a/assets/icon-src/icon.svg +++ b/assets/icon-src/icon.svg @@ -1,32 +1 @@ - - - - - - - - - - - - - - - - - - - - - + diff --git a/assets/icon-src/make.py b/assets/icon-src/make.py new file mode 100644 index 0000000..e863f0c --- /dev/null +++ b/assets/icon-src/make.py @@ -0,0 +1,116 @@ +#!/usr/bin/env python3 +"""Generate the Health app icon set from one mark: a live heartbeat trace. + + python3 assets/icon-src/make.py # needs `resvg` and `magick` (Homebrew) + +The mark is a bold ECG trace in the dashboard's blue → violet → pink gradient +that fades in from the left and ends in a glowing "now" dot, like the live +point on a chart. The background is the app's near-black (#0d0d0f) with a +violet glow. + +Writes the SVG sources next to this file and the PNGs into assets/images/: + icon.png 1024 opaque (iOS + fallback) + android-icon-background.png 1024 opaque (adaptive background) + android-icon-foreground.png 1024 alpha (adaptive foreground, inside the 66dp safe zone) + android-icon-monochrome.png 1024 alpha (themed icon, white glyph) + splash-icon.png 512 alpha (splash, glyph only) + favicon.png 64 opaque (web) +""" +import os +import subprocess + +HERE = os.path.dirname(os.path.abspath(__file__)) +IMAGES = os.path.join(HERE, '..', 'images') + +BG_CENTER, BG_EDGE = '#1d1a33', '#0b0b0e' +TRACE = [(0, '#3fc8f2'), (0.5, '#7c6cf7'), (1, '#f06bc0')] # blue → accent violet → pink + +# x in 0..1 across the glyph, y in -1..1 (negative = up) +PULSE = [(0.00, 0), (0.22, 0), (0.29, -0.17), (0.35, 0.0), (0.40, 0), + (0.49, -1.0), (0.59, 0.82), (0.67, -0.20), (0.72, 0), (0.90, 0)] + + +def svg(size, body, defs=''): + return (f'{defs}{body}\n') + + +def background(size): + defs = (f'' + f'') + return defs, f'' + + +def pulse(size, scale, mono=False, glow=True, shift=0.0, halo=1.55): + """scale = glyph width as a fraction of the canvas.""" + w = size * scale + amp, stroke = w * 0.42, w * 0.105 + c = size / 2 + left = c - shift * w - w / 2 + pts = [(left + x * w, c + amp * 0.08 + y * amp) for x, y in PULSE] + if mono: # no fade in a single colour: start the trace later instead + pts = [(left + 0.12 * w, pts[0][1])] + pts[2:] + d = 'M' + ' L'.join(f'{x:.1f} {y:.1f}' for x, y in pts) + ex, ey = pts[-1] + line = (f'') + if mono: + return '', line.format(s='#fff') + f'' + + stops = ''.join(f'' for p, col in TRACE) + defs = (f'{stops}' + f'' + f'' + f'' + f'' + f'' + f'' + f'' + f'') + trace = line.format(s='url(#pl)') + body = '' + if glow: + body += f'{trace}' + body += f'' + body += f'{trace}' + body += (f'') + body += f'' + return defs, body + + +def main(): + bd, bb = background(1024) + # iOS: full-bleed, glyph spans 76% (Apple rounds the corners itself) + gd, gb = pulse(1024, 0.76) + sources = { + 'icon': (1024, svg(1024, bb + gb, bd + gd)), + 'background': (1024, svg(1024, bb, bd)), + # Android adaptive: shifted left (the trace fades in) so the dot + halo clear the 66dp safe circle + 'foreground': (1024, svg(1024, *reversed(pulse(1024, 0.55, shift=0.045, halo=1.35)))), + # themed icons read best a little smaller than the colour glyph + 'monochrome': (1024, svg(1024, *reversed(pulse(1024, 0.46, mono=True, glow=False, shift=0.045)))), + 'splash': (512, svg(512, *reversed(pulse(512, 0.94, glow=False)))), + } + out = { + 'icon': 'icon.png', 'background': 'android-icon-background.png', + 'foreground': 'android-icon-foreground.png', 'monochrome': 'android-icon-monochrome.png', + 'splash': 'splash-icon.png', + } + for name, (size, text) in sources.items(): + src = os.path.join(HERE, f'{name}.svg') + with open(src, 'w') as f: + f.write(text) + png = os.path.join(IMAGES, out[name]) + subprocess.run(['resvg', '-w', str(size), '-h', str(size), src, png], check=True) + # iOS rejects icons with an alpha channel; the web favicon is the icon at 64px + icon = os.path.join(IMAGES, 'icon.png') + subprocess.run(['magick', icon, '-background', BG_EDGE, '-alpha', 'remove', '-alpha', 'off', icon], check=True) + bgp = os.path.join(IMAGES, 'android-icon-background.png') + subprocess.run(['magick', bgp, '-alpha', 'off', bgp], check=True) + subprocess.run(['magick', icon, '-resize', '64x64', os.path.join(IMAGES, 'favicon.png')], check=True) + print('wrote', ', '.join(out.values()), 'favicon.png') + + +if __name__ == '__main__': + main() diff --git a/assets/icon-src/monochrome.svg b/assets/icon-src/monochrome.svg index a902c6b..806c99d 100644 --- a/assets/icon-src/monochrome.svg +++ b/assets/icon-src/monochrome.svg @@ -1,21 +1 @@ - - - - - - - - - - - - + diff --git a/assets/icon-src/splash.svg b/assets/icon-src/splash.svg new file mode 100644 index 0000000..0c83009 --- /dev/null +++ b/assets/icon-src/splash.svg @@ -0,0 +1 @@ + diff --git a/assets/images/android-icon-background.png b/assets/images/android-icon-background.png index 7beab71..ce0531d 100644 Binary files a/assets/images/android-icon-background.png and b/assets/images/android-icon-background.png differ diff --git a/assets/images/android-icon-foreground.png b/assets/images/android-icon-foreground.png index a0a1e45..3a494e0 100644 Binary files a/assets/images/android-icon-foreground.png and b/assets/images/android-icon-foreground.png differ diff --git a/assets/images/android-icon-monochrome.png b/assets/images/android-icon-monochrome.png index a665381..48c8fc5 100644 Binary files a/assets/images/android-icon-monochrome.png and b/assets/images/android-icon-monochrome.png differ diff --git a/assets/images/favicon.png b/assets/images/favicon.png index e309bab..4c7a10c 100644 Binary files a/assets/images/favicon.png and b/assets/images/favicon.png differ diff --git a/assets/images/icon.png b/assets/images/icon.png index e60a6a6..c54f0b5 100644 Binary files a/assets/images/icon.png and b/assets/images/icon.png differ diff --git a/assets/images/splash-icon.png b/assets/images/splash-icon.png index 4048461..54d0673 100644 Binary files a/assets/images/splash-icon.png and b/assets/images/splash-icon.png differ