neotalk/packaging/make-icons.sh
Andros Fenollosa 41966a4a10 Add app icon (two-bubble P2P mark) for macOS and Windows
SVG source plus generated .icns/.ico, wired into the PyInstaller spec, and a
make-icons.sh to regenerate them from the SVG.
2026-08-21 10:05:18 +02:00

41 lines
1.2 KiB
Bash
Executable file

#!/usr/bin/env bash
# Regenerate assets/icon.icns (macOS) and assets/icon.ico (Windows) from
# assets/icon.svg. Run from the repository root on macOS.
#
# Requires: rsvg-convert (brew install librsvg), iconutil (macOS), and Pillow
# (pulled in on demand via uv).
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
SVG="$ROOT/assets/icon.svg"
# --- macOS .icns ---
ICONSET="$ROOT/assets/icon.iconset"
rm -rf "$ICONSET" && mkdir -p "$ICONSET"
declare -a MAP=(
"16:icon_16x16" "32:icon_16x16@2x"
"32:icon_32x32" "64:icon_32x32@2x"
"128:icon_128x128" "256:icon_128x128@2x"
"256:icon_256x256" "512:icon_256x256@2x"
"512:icon_512x512" "1024:icon_512x512@2x"
)
for pair in "${MAP[@]}"; do
rsvg-convert -w "${pair%%:*}" -h "${pair%%:*}" "$SVG" \
-o "$ICONSET/${pair##*:}.png"
done
iconutil -c icns "$ICONSET" -o "$ROOT/assets/icon.icns"
rm -rf "$ICONSET"
# --- Windows .ico ---
rsvg-convert -w 256 -h 256 "$SVG" -o /tmp/neotalk-icon-256.png
uv run --with pillow python - <<'PY'
from PIL import Image
img = Image.open("/tmp/neotalk-icon-256.png").convert("RGBA")
img.save(
"assets/icon.ico",
sizes=[(16, 16), (24, 24), (32, 32), (48, 48), (64, 64), (128, 128), (256, 256)],
)
PY
echo "Wrote assets/icon.icns and assets/icon.ico"