diff --git a/harbour-calibreweb.pro b/harbour-calibreweb.pro index 7a5b444..cc92968 100644 --- a/harbour-calibreweb.pro +++ b/harbour-calibreweb.pro @@ -44,4 +44,8 @@ icons86.path = /usr/share/icons/hicolor/86x86/apps icons86.files = $$PWD/icons/86x86/harbour-calibreweb.png icons108.path = /usr/share/icons/hicolor/108x108/apps icons108.files = $$PWD/icons/108x108/harbour-calibreweb.png -INSTALLS += icons86 icons108 +icons128.path = /usr/share/icons/hicolor/128x128/apps +icons128.files = $$PWD/icons/128x128/harbour-calibreweb.png +icons172.path = /usr/share/icons/hicolor/172x172/apps +icons172.files = $$PWD/icons/172x172/harbour-calibreweb.png +INSTALLS += icons86 icons108 icons128 icons172 diff --git a/icons/108x108/harbour-calibreweb.png b/icons/108x108/harbour-calibreweb.png index 52581d1..5e9799b 100644 Binary files a/icons/108x108/harbour-calibreweb.png and b/icons/108x108/harbour-calibreweb.png differ diff --git a/icons/128x128/harbour-calibreweb.png b/icons/128x128/harbour-calibreweb.png new file mode 100644 index 0000000..85a5fe2 Binary files /dev/null and b/icons/128x128/harbour-calibreweb.png differ diff --git a/icons/172x172/harbour-calibreweb.png b/icons/172x172/harbour-calibreweb.png new file mode 100644 index 0000000..90c4e4e Binary files /dev/null and b/icons/172x172/harbour-calibreweb.png differ diff --git a/icons/86x86/harbour-calibreweb.png b/icons/86x86/harbour-calibreweb.png index f08f3d0..3705822 100644 Binary files a/icons/86x86/harbour-calibreweb.png and b/icons/86x86/harbour-calibreweb.png differ diff --git a/icons/make_icons.py b/icons/make_icons.py index 5aeec93..325b233 100644 --- a/icons/make_icons.py +++ b/icons/make_icons.py @@ -1,53 +1,86 @@ #!/usr/bin/env python3 -"""Genera le icone dell'app nella struttura standard Sailfish: - icons/86x86/harbour-calibreweb.png e icons/108x108/harbour-calibreweb.png""" +"""Genera le icone dell'app in stile Sailfish OS: + sfondo a gradiente azzurro->blu con angoli molto arrotondati, + libro aperto bianco con ombra morbida e righe di testo tenui. + Dimensioni: 86, 108, 128, 172 (struttura standard hicolor).""" 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 +# gradiente Sailfish: azzurro chiaro (alto) -> blu profondo (basso) +C_TOP = (94, 210, 240) # #5ED2F0 +C_BOT = (14, 111, 168) # #0E6FA8 +PAGE = (255, 255, 255) +TEXT = (120, 190, 225) # righe del testo, tenue +SPINE = (200, 225, 240) -def draw_icon(size): - img = Image.new("RGBA", (size, size), (0, 0, 0, 0)) +def gradient(size, c1, c2): + img = Image.new("RGB", (size, size)) 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) + for y in range(size): + t = y / (size - 1) + d.line([(0, y), (size, y)], + fill=(int(c1[0] + (c2[0] - c1[0]) * t), + int(c1[1] + (c2[1] - c1[1]) * t), + int(c1[2] + (c2[2] - c1[2]) * t))) return img +def draw_icon(size): + m = size * 0.05 + r = size * 0.22 + out = Image.new("RGBA", (size, size), (0, 0, 0, 0)) + + # sfondo: gradiente ritagliato nel rounded rect + grad = gradient(size, C_TOP, C_BOT).convert("RGBA") + mask = Image.new("L", (size, size), 0) + ImageDraw.Draw(mask).rounded_rectangle([m, m, size - m, size - m], + radius=r, fill=255) + out.paste(grad, (0, 0), mask) + + d = ImageDraw.Draw(out) + + cx = size / 2 + top = size * 0.33 + bot = size * 0.66 + half = size * 0.15 + ol = size * 0.24 + orr = size * 0.76 + + def pages(): + return ([(cx - half, top), (cx, top), (cx, bot), (ol, bot + size * 0.035)], + [(cx, top), (cx + half, top), (orr, bot + size * 0.035), (cx, bot)]) + + lp, rp = pages() + # ombra morbida sotto il libro (rilievo stile Sailfish) + sh = size * 0.022 + shadow = Image.new("RGBA", (size, size), (0, 0, 0, 0)) + ds = ImageDraw.Draw(shadow) + lps, rps = pages() + ds.polygon([(x, y + sh) for x, y in lps], fill=(0, 60, 100, 90)) + ds.polygon([(x, y + sh) for x, y in rps], fill=(0, 60, 100, 90)) + out.alpha_composite(shadow) + + d.polygon(lp, fill=PAGE) + d.polygon(rp, fill=PAGE) + d.rectangle([cx - size * 0.016, top, cx + size * 0.016, bot], fill=SPINE) + + # righe di testo sulle pagine + lw = max(1, int(size * 0.012)) + for yf, dy in ((0.46, 0.022), (0.53, 0.026), (0.60, 0.030)): + y = size * yf + d.line([(cx - half + size * 0.045, y), (ol + size * 0.05, y + size * dy)], + fill=TEXT, width=lw) + d.line([(cx + half - size * 0.045, y), (orr - size * 0.05, y + size * dy)], + fill=TEXT, width=lw) + return out + + 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/") + for s in (86, 108, 128, 172): + os.makedirs(f"icons/{s}x{s}", exist_ok=True) + draw_icon(s).save(f"icons/{s}x{s}/harbour-calibreweb.png") + print("icone scritte: 86, 108, 128, 172") if __name__ == "__main__": diff --git a/rpm/harbour-calibreweb.spec b/rpm/harbour-calibreweb.spec index 16b7540..d22ae37 100644 --- a/rpm/harbour-calibreweb.spec +++ b/rpm/harbour-calibreweb.spec @@ -90,5 +90,7 @@ install -m 0644 %{_builddir}/%{name}_it.qm %{buildroot}%{_datadir}/%{name}/trans %{_datadir}/applications/%{name}.desktop %{_datadir}/icons/hicolor/86x86/apps/%{name}.png %{_datadir}/icons/hicolor/108x108/apps/%{name}.png +%{_datadir}/icons/hicolor/128x128/apps/%{name}.png +%{_datadir}/icons/hicolor/172x172/apps/%{name}.png %{_datadir}/%{name}/qml %{_datadir}/%{name}/translations/%{name}*.qm