Icona in stile Sailfish OS: gradiente azzurro-blu con angoli arrotondati, libro aperto bianco con ombra e righe di testo tenui; dimensioni 86/108/128/172 installate
This commit is contained in:
@@ -44,4 +44,8 @@ icons86.path = /usr/share/icons/hicolor/86x86/apps
|
|||||||
icons86.files = $$PWD/icons/86x86/harbour-calibreweb.png
|
icons86.files = $$PWD/icons/86x86/harbour-calibreweb.png
|
||||||
icons108.path = /usr/share/icons/hicolor/108x108/apps
|
icons108.path = /usr/share/icons/hicolor/108x108/apps
|
||||||
icons108.files = $$PWD/icons/108x108/harbour-calibreweb.png
|
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
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 796 B After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 629 B After Width: | Height: | Size: 1.1 KiB |
+72
-39
@@ -1,53 +1,86 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""Genera le icone dell'app nella struttura standard Sailfish:
|
"""Genera le icone dell'app in stile Sailfish OS:
|
||||||
icons/86x86/harbour-calibreweb.png e icons/108x108/harbour-calibreweb.png"""
|
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
|
import os
|
||||||
from PIL import Image, ImageDraw
|
from PIL import Image, ImageDraw
|
||||||
|
|
||||||
BG = (46, 52, 64) # #2E3440
|
# gradiente Sailfish: azzurro chiaro (alto) -> blu profondo (basso)
|
||||||
ACCENT = (136, 192, 208) # #88C0D0
|
C_TOP = (94, 210, 240) # #5ED2F0
|
||||||
PAGE = (229, 233, 240) # #E5E9F0
|
C_BOT = (14, 111, 168) # #0E6FA8
|
||||||
SPINE = (94, 129, 172) # #5E81AC
|
PAGE = (255, 255, 255)
|
||||||
|
TEXT = (120, 190, 225) # righe del testo, tenue
|
||||||
|
SPINE = (200, 225, 240)
|
||||||
|
|
||||||
|
|
||||||
def draw_icon(size):
|
def gradient(size, c1, c2):
|
||||||
img = Image.new("RGBA", (size, size), (0, 0, 0, 0))
|
img = Image.new("RGB", (size, size))
|
||||||
d = ImageDraw.Draw(img)
|
d = ImageDraw.Draw(img)
|
||||||
margin = size * 0.045
|
for y in range(size):
|
||||||
radius = size * 0.16
|
t = y / (size - 1)
|
||||||
d.rounded_rectangle([margin, margin, size - margin, size - margin],
|
d.line([(0, y), (size, y)],
|
||||||
radius=radius, fill=BG)
|
fill=(int(c1[0] + (c2[0] - c1[0]) * t),
|
||||||
|
int(c1[1] + (c2[1] - c1[1]) * t),
|
||||||
cx = size / 2
|
int(c1[2] + (c2[2] - c1[2]) * t)))
|
||||||
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
|
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():
|
def main():
|
||||||
os.makedirs("icons/86x86", exist_ok=True)
|
for s in (86, 108, 128, 172):
|
||||||
os.makedirs("icons/108x108", exist_ok=True)
|
os.makedirs(f"icons/{s}x{s}", exist_ok=True)
|
||||||
draw_icon(86).save("icons/86x86/harbour-calibreweb.png")
|
draw_icon(s).save(f"icons/{s}x{s}/harbour-calibreweb.png")
|
||||||
draw_icon(108).save("icons/108x108/harbour-calibreweb.png")
|
print("icone scritte: 86, 108, 128, 172")
|
||||||
print("icone scritte in icons/86x86/ e icons/108x108/")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -90,5 +90,7 @@ install -m 0644 %{_builddir}/%{name}_it.qm %{buildroot}%{_datadir}/%{name}/trans
|
|||||||
%{_datadir}/applications/%{name}.desktop
|
%{_datadir}/applications/%{name}.desktop
|
||||||
%{_datadir}/icons/hicolor/86x86/apps/%{name}.png
|
%{_datadir}/icons/hicolor/86x86/apps/%{name}.png
|
||||||
%{_datadir}/icons/hicolor/108x108/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}/qml
|
||||||
%{_datadir}/%{name}/translations/%{name}*.qm
|
%{_datadir}/%{name}/translations/%{name}*.qm
|
||||||
|
|||||||
Reference in New Issue
Block a user