Files
harbour-grumpydove/scripts/make_icons.py
T

34 lines
1.0 KiB
Python

#!/usr/bin/env python3
"""Icone del prototipo: busta stilizzata su sfondo scuro (palette Nord)."""
import os
from PIL import Image, ImageDraw
BG = (46, 52, 64)
ACCENT = (136, 192, 208)
PAGE = (229, 233, 240)
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
def draw_icon(size):
img = Image.new("RGBA", (size, size), (0, 0, 0, 0))
d = ImageDraw.Draw(img)
m = size * 0.045
d.rounded_rectangle([m, m, size - m, size - m], radius=size * 0.16, fill=BG)
# busta
left, right = size * 0.20, size * 0.80
top, bot = size * 0.34, size * 0.66
lw = max(2, int(size * 0.035))
d.rectangle([left, top, right, bot], outline=ACCENT, width=lw)
d.line([left, top, size * 0.5, size * 0.53], fill=PAGE, width=lw)
d.line([right, top, size * 0.5, size * 0.53], fill=PAGE, width=lw)
return img
for s in (86, 108, 128, 172):
out = os.path.join(ROOT, "icons", "%dx%d" % (s, s))
os.makedirs(out, exist_ok=True)
draw_icon(s).save(os.path.join(out, "harbour-grumpydove.png"))
print("scritto", out)