New app icon: live heartbeat trace
Some checks failed
Build & Release APK / build (push) Has been cancelled

Replaces the outlined-ECG-over-a-heart icon with a bold heartbeat trace in
the dashboard's blue → violet → pink gradient. It fades in from the left
and ends in a glowing "now" dot, like the live point on a chart, over the
app's near-black with a violet glow. The Android foreground is sized to the
66dp safe circle, the themed (monochrome) glyph is solid and a little
smaller, and the adaptive background is now the gradient.

assets/icon-src/make.py (resvg + magick) regenerates every size from one
definition; glyph.svg is replaced by foreground/background/splash.svg.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
marcus
2026-11-19 23:45:47 -08:00
parent 65bf540ea0
commit 694e180855
13 changed files with 121 additions and 78 deletions

116
assets/icon-src/make.py Normal file
View File

@@ -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'<svg xmlns="http://www.w3.org/2000/svg" width="{size}" height="{size}" '
f'viewBox="0 0 {size} {size}"><defs>{defs}</defs>{body}</svg>\n')
def background(size):
defs = (f'<radialGradient id="hb" cx="50%" cy="44%" r="72%">'
f'<stop offset="0" stop-color="{BG_CENTER}"/><stop offset="1" stop-color="{BG_EDGE}"/></radialGradient>')
return defs, f'<rect width="{size}" height="{size}" fill="url(#hb)"/>'
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'<path d="{d}" fill="none" stroke="{{s}}" stroke-width="{stroke:.1f}" '
f'stroke-linecap="round" stroke-linejoin="round"/>')
if mono:
return '', line.format(s='#fff') + f'<circle cx="{ex:.1f}" cy="{ey:.1f}" r="{stroke * 0.95:.1f}" fill="#fff"/>'
stops = ''.join(f'<stop offset="{p}" stop-color="{col}"/>' for p, col in TRACE)
defs = (f'<linearGradient id="pl" gradientUnits="userSpaceOnUse" x1="{left:.1f}" y1="0" x2="{ex:.1f}" y2="0">{stops}</linearGradient>'
f'<linearGradient id="fadeg" gradientUnits="userSpaceOnUse" x1="{left:.1f}" y1="0" x2="{left + w * 0.22:.1f}" y2="0">'
f'<stop offset="0" stop-color="#fff" stop-opacity="0.05"/><stop offset="1" stop-color="#fff"/></linearGradient>'
f'<mask id="fm" maskUnits="userSpaceOnUse" x="0" y="0" width="{size}" height="{size}">'
f'<rect width="{size}" height="{size}" fill="url(#fadeg)"/></mask>'
f'<filter id="bl" x="-50%" y="-50%" width="200%" height="200%"><feGaussianBlur stdDeviation="{stroke * 0.55:.1f}"/></filter>'
f'<filter id="bl2" x="-100%" y="-100%" width="300%" height="300%"><feGaussianBlur stdDeviation="{stroke * 0.9:.1f}"/></filter>'
f'<radialGradient id="dot"><stop offset="0" stop-color="#ffffff"/><stop offset="0.55" stop-color="#ffe6f4"/>'
f'<stop offset="1" stop-color="{TRACE[-1][1]}"/></radialGradient>')
trace = line.format(s='url(#pl)')
body = ''
if glow:
body += f'<g mask="url(#fm)" filter="url(#bl)" opacity="0.75">{trace}</g>'
body += f'<circle cx="{ex:.1f}" cy="{ey:.1f}" r="{stroke * 1.9:.1f}" fill="{TRACE[-1][1]}" opacity="0.55" filter="url(#bl2)"/>'
body += f'<g mask="url(#fm)">{trace}</g>'
body += (f'<circle cx="{ex:.1f}" cy="{ey:.1f}" r="{stroke * halo:.1f}" fill="none" stroke="{TRACE[-1][1]}" '
f'stroke-opacity="0.35" stroke-width="{stroke * 0.22:.1f}"/>')
body += f'<circle cx="{ex:.1f}" cy="{ey:.1f}" r="{stroke * 0.92:.1f}" fill="url(#dot)"/>'
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()