Private
Public Access
Minamp 1.7: new launcher icon
- Launcher icon is now a supplied asset (masters in art/), with an xhdpi size added; make_icons.py only draws the notification icon, redrawn to match: an amber play triangle between orange arcs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bbdab09f83
commit
f7f49ecfbb
12 files changed
+21
-37
No files matched your search
+19
-35
@@ -1,53 +1,37 @@
|
||||
"""Draws the launcher and status-bar icons at ldpi/mdpi/hdpi (supersampled for smooth edges)."""
|
||||
"""Draws the notification (status bar) icon at ldpi/mdpi/hdpi/xhdpi, matching the launcher icon:
|
||||
an amber play triangle between orange arcs, on transparent (supersampled).
|
||||
|
||||
The launcher icon itself is a supplied asset (res/drawable-*/ic_launcher.png, masters in art/)
|
||||
and is not generated here.
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
RES = sys.argv[1]
|
||||
BG = (24, 24, 29, 255)
|
||||
ACCENT = (247, 176, 46, 255)
|
||||
DARK = (22, 19, 12, 255)
|
||||
|
||||
|
||||
def launcher(size):
|
||||
S = size * 8
|
||||
im = Image.new("RGBA", (S, S), (0, 0, 0, 0))
|
||||
d = ImageDraw.Draw(im)
|
||||
pad = S * 0.06
|
||||
d.rounded_rectangle([pad, pad, S - pad, S - pad], radius=S * 0.22, fill=BG)
|
||||
# amber disc with a ring groove and a play notch: a record that is also a play button
|
||||
c = S * 0.46
|
||||
r = S * 0.29
|
||||
d.ellipse([c - r, c - r, c + r, c + r], fill=ACCENT)
|
||||
rr = r * 0.72
|
||||
w = max(2, int(S * 0.018))
|
||||
d.ellipse([c - rr, c - rr, c + rr, c + rr], outline=DARK, width=w)
|
||||
t = r * 0.42
|
||||
d.polygon([(c - t * 0.55, c - t), (c + t * 0.95, c), (c - t * 0.55, c + t)], fill=DARK)
|
||||
# three level bars, lower right
|
||||
bw = S * 0.045
|
||||
for i, h in enumerate((0.10, 0.17, 0.13)):
|
||||
x = S * 0.72 + i * bw * 1.6
|
||||
d.rounded_rectangle([x, S * 0.82 - S * h, x + bw, S * 0.82], radius=bw / 2, fill=ACCENT)
|
||||
return im.resize((size, size), Image.LANCZOS)
|
||||
AMBER = (255, 196, 0, 255)
|
||||
YELLOW = (255, 199, 20, 255)
|
||||
ORANGE = (255, 128, 0, 255)
|
||||
|
||||
|
||||
def status(size):
|
||||
# one pair of arcs: at 19-25 px two pairs crowd the triangle
|
||||
S = size * 8
|
||||
im = Image.new("RGBA", (S, S), (0, 0, 0, 0))
|
||||
d = ImageDraw.Draw(im)
|
||||
c = S / 2
|
||||
r = S * 0.44
|
||||
d.ellipse([c - r, c - r, c + r, c + r], fill=ACCENT)
|
||||
t = r * 0.45
|
||||
d.polygon([(c - t * 0.55, c - t), (c + t * 0.95, c), (c - t * 0.55, c + t)], fill=(0, 0, 0, 0))
|
||||
w = max(2, int(S * 0.11))
|
||||
r = S * 0.43
|
||||
box = [c - r, c - r, c + r, c + r]
|
||||
d.arc(box, 135, 225, fill=ORANGE, width=w)
|
||||
d.arc(box, -45, 45, fill=ORANGE, width=w)
|
||||
t = S * 0.24
|
||||
d.polygon([(c - t * 0.72, c - t), (c + t * 1.0, c), (c - t * 0.72, c + t)], fill=AMBER)
|
||||
return im.resize((size, size), Image.LANCZOS)
|
||||
|
||||
|
||||
for folder, ls, ss in (("drawable-ldpi", 36, 19), ("drawable-mdpi", 48, 25), ("drawable-hdpi", 72, 38)):
|
||||
for folder, ss in (("drawable-ldpi", 19), ("drawable-mdpi", 25), ("drawable-hdpi", 38), ("drawable-xhdpi", 50)):
|
||||
os.makedirs(os.path.join(RES, folder), exist_ok=True)
|
||||
launcher(ls).save(os.path.join(RES, folder, "ic_launcher.png"))
|
||||
status(ss).save(os.path.join(RES, folder, "ic_stat.png"))
|
||||
launcher(192).save(os.path.join(os.path.dirname(RES.rstrip("/")), "icon-preview.png"))
|
||||
print("icons written")
|
||||
print("status icons written")
|
||||
Reference in new issue
Block a user