#!/usr/bin/env python3 """Genera le icone dell'app nella struttura standard Sailfish: icons/86x86/harbour-calibreweb.png e icons/108x108/harbour-calibreweb.png""" import os from PIL import Image, ImageDraw BG = (46, 52, 64) # #2E3440 ACCENT = (136, 192, 208) # #88C0D0 PAGE = (229, 233, 240) # #E5E9F0 SPINE = (94, 129, 172) # #5E81AC def draw_icon(size): img = Image.new("RGBA", (size, size), (0, 0, 0, 0)) d = ImageDraw.Draw(img) margin = size * 0.045 radius = size * 0.16 d.rounded_rectangle([margin, margin, size - margin, size - margin], radius=radius, fill=BG) cx = size / 2 top = size * 0.34 bot = size * 0.68 half = size * 0.16 outer_l = size * 0.22 outer_r = size * 0.78 left_page = [(cx - half, top), (cx, top), (cx, bot), (outer_l, bot + size * 0.04)] right_page = [(cx, top), (cx + half, top), (outer_r, bot + size * 0.04), (cx, bot)] d.polygon(left_page, fill=ACCENT) d.polygon(right_page, fill=ACCENT) d.rectangle([cx - size * 0.014, top, cx + size * 0.014, bot], fill=SPINE) lw = max(1, int(size * 0.012)) for y_frac in (0.45, 0.52, 0.59): y = size * y_frac d.line([(cx - half + size * 0.03, y), (outer_l + size * 0.06, y + size * 0.025)], fill=PAGE, width=lw) d.line([(cx + half - size * 0.03, y), (outer_r - size * 0.06, y + size * 0.025)], fill=PAGE, width=lw) return img def main(): os.makedirs("icons/86x86", exist_ok=True) os.makedirs("icons/108x108", exist_ok=True) draw_icon(86).save("icons/86x86/harbour-calibreweb.png") draw_icon(108).save("icons/108x108/harbour-calibreweb.png") print("icone scritte in icons/86x86/ e icons/108x108/") if __name__ == "__main__": main()