Fill the launcher icon's shape instead of framing it in white

Launchers on Android 8+ and Android Auto put the old icon, a rounded square
with a transparent margin, inside their own shape and filled the margin with
white. Both apps now have an adaptive icon (the gradient behind a wave layer,
which also serves as the themed monochrome icon), and the legacy PNGs are
opaque full-bleed squares, so nothing is left to frame. make_icon.py draws
both with --foreground and --square.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
yuriy.pandClaude Opus 5.5 committed 2026-10-30 10:30:52 +06:00
1 parent 461a3cf4d4
commit 6e6b260020
25 files changed
+58 -4

No files matched your search

+26 -4
View File
@@ -3,6 +3,16 @@
Aubergine squircle with amber wave lines, matching the My Wave hero.
Usage: python3 tool/make_icon.py assets/icon/musyx.png
With --foreground it draws the adaptive icon's foreground instead: the waves
alone on a transparent, full-bleed 108dp canvas, laid out so the launcher's
mask (the middle 72dp) shows what the squircle does. The background layer is
the gradient in res/drawable/ic_launcher_background.xml.
With --square it draws the legacy res/mipmap-*/ic_launcher.png: the artwork as
an opaque, full-bleed square. Anything that still loads the legacy icon on a
newer Android (Android Auto's media header does) wraps it in a shape, and any
transparent margin left in it shows there as a white frame.
"""
import math
import struct
@@ -12,6 +22,12 @@ import zlib
SIZE = 1024
# macOS icon grid: the body is 824px, centred, with a ~185px corner radius.
BODY, RADIUS = 824, 185
FOREGROUND = "--foreground" in sys.argv
SQUARE = "--square" in sys.argv
if FOREGROUND:
BODY = SIZE * 72 / 108
if SQUARE:
BODY = SIZE
OFF = (SIZE - BODY) / 2
TOP, BOTTOM = (0x35, 0x30, 0x42), (0x1C, 0x1A, 0x22)
AMBER = (0xF0, 0xB2, 0x3E)
@@ -51,22 +67,27 @@ def main(out):
t = y / SIZE
bg = tuple(round(TOP[i] + (BOTTOM[i] - TOP[i]) * t) for i in range(3))
for x in range(SIZE):
cover = rounded_alpha(x, y)
cover = 1.0 if FOREGROUND or SQUARE else rounded_alpha(x, y)
if cover == 0.0:
row += b"\x00\x00\x00\x00"
continue
r, g, b = bg
clear = 1.0 # how much of the background the lines leave showing
for k in range(LINES):
cy, slope = curves[k][x]
dist = abs(y + 0.5 - cy) / math.sqrt(1 + slope * slope)
width = 4.0 + k * 0.9
width = (4.0 + k * 0.9) * BODY / 824
a = min(max(width / 2 - dist + 0.5, 0.0), 1.0)
if a:
a *= 0.18 + 0.82 * (k / (LINES - 1))
clear *= 1 - a
r = r + (AMBER[0] - r) * a
g = g + (AMBER[1] - g) * a
b = b + (AMBER[2] - b) * a
row += bytes((round(r), round(g), round(b), round(cover * 255)))
if FOREGROUND:
row += bytes((*AMBER, round((1 - clear) * 255)))
else:
row += bytes((round(r), round(g), round(b), round(cover * 255)))
rows.append(bytes(row))
def chunk(kind, data):
@@ -81,4 +102,5 @@ def main(out):
if __name__ == "__main__":
main(sys.argv[1] if len(sys.argv) > 1 else "musyx.png")
args = [a for a in sys.argv[1:] if not a.startswith("--")]
main(args[0] if args else "musyx.png")