"""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] 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 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, ss in (("drawable-ldpi", 19), ("drawable-mdpi", 25), ("drawable-hdpi", 38), ("drawable-xhdpi", 50)): os.makedirs(os.path.join(RES, folder), exist_ok=True) status(ss).save(os.path.join(RES, folder, "ic_stat.png")) print("status icons written")