Switch the customer app to IRANSans, restyle home featured/newest and cart note sheet, refresh brand icons across apps, and add the PWA install prompt. Co-authored-by: Cursor <cursoragent@cursor.com>
45 lines
2.0 KiB
Python
45 lines
2.0 KiB
Python
"""
|
|
Legacy Python generator — prefer scripts/generate-brand-icons.mjs when Node + sharp are available.
|
|
|
|
Point `src` at the icon-only master (scripts/brand-assets/hedena-icon.webp), then run from repo root.
|
|
"""
|
|
from PIL import Image
|
|
from pathlib import Path
|
|
|
|
src = Path(__file__).resolve().parent / "brand-assets" / "hedena-icon.webp"
|
|
img = Image.open(src).convert("RGBA")
|
|
print("source size", img.size)
|
|
|
|
root = Path(__file__).resolve().parents[1]
|
|
(root / "apps/user-app/public/img").mkdir(parents=True, exist_ok=True)
|
|
(root / "apps/user-app/src/assets/img").mkdir(parents=True, exist_ok=True)
|
|
(root / "apps/admin-panel/src/assets/images/logo").mkdir(parents=True, exist_ok=True)
|
|
(root / "apps/admin-panel/public").mkdir(parents=True, exist_ok=True)
|
|
|
|
img.save(root / "apps/user-app/public/img/brand-logo.webp", "WEBP")
|
|
img.save(root / "apps/user-app/public/img/brand-logo.png", "PNG")
|
|
img.save(root / "apps/user-app/src/assets/img/brand-logo.png", "PNG")
|
|
img.save(root / "apps/user-app/public/img/no-items.png", "PNG")
|
|
img.save(root / "apps/user-app/src/assets/img/no-items.png", "PNG")
|
|
img.save(root / "apps/admin-panel/src/assets/images/logo/brand-icon.webp", "WEBP")
|
|
img.save(root / "apps/admin-panel/src/assets/images/logo/brand-icon.png", "PNG")
|
|
img.save(root / "apps/admin-panel/src/assets/images/logo/brand-horizontal.png", "PNG")
|
|
|
|
for size, path in [
|
|
(192, root / "apps/user-app/public/icon-192.png"),
|
|
(512, root / "apps/user-app/public/icon-512.png"),
|
|
(192, root / "apps/admin-panel/public/icon-192.png"),
|
|
(512, root / "apps/admin-panel/public/icon-512.png"),
|
|
(32, root / "apps/admin-panel/public/favicon.png"),
|
|
]:
|
|
icon = Image.new("RGBA", (size, size), (0, 0, 0, 255))
|
|
fitted = img.copy()
|
|
fitted.thumbnail((size, size), Image.Resampling.LANCZOS)
|
|
x = (size - fitted.width) // 2
|
|
y = (size - fitted.height) // 2
|
|
icon.paste(fitted, (x, y), fitted)
|
|
icon.save(path, "PNG")
|
|
print("wrote", path)
|
|
|
|
print("Note: favicon.ico is generated by scripts/generate-brand-icons.mjs (to-ico).")
|