#!/usr/bin/env bash # Regenerate every app icon file from assets/app-icon/anicraft.svg (the canonical artwork). # # Needs: resvg (cargo install resvg) and Python with Pillow (for the .ico). The outputs are # committed, so building never needs these tools. # # scripts/icons.sh set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" DIR="$ROOT/assets/app-icon" SVG="$DIR/anicraft.svg" ID="ai.storyteller.anicraft" TMP="$(mktemp -d)" trap 'rm -rf "$TMP"' EXIT command -v resvg >/dev/null || { echo "error: resvg not found (cargo install resvg)" >&2; exit 1; } # The SVG is a full-bleed 512 tile, used as-is on Windows and Linux. macOS icons follow Apple's grid: # the tile is 824/1024 of the canvas with a transparent margin, so widen the viewBox around it. MAC="$TMP/mac.svg" sed 's/viewBox="0 0 512 512"/viewBox="-62.136 -62.136 636.272 636.272"/' "$SVG" >"$MAC" grep -q 'viewBox="-62.136' "$MAC" || { echo "error: $SVG has no 512 viewBox" >&2; exit 1; } render() { resvg -w "$2" -h "$2" "$1" "$3"