Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions scripts/build-icons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,35 @@
# resources/icon.icns macOS bundle icon, built via iconutil
# site/public/icon.png 512 site favicon + PWA icon
# site/public/apple-touch-icon.png 180
# src/web-client/public/icon.png 1024 web client favicon + manifest "any"
# src/web-client/public/icon-maskable.png 1024 manifest "maskable"
# src/web-client/public/apple-touch-icon.png 1024 iOS Home Screen
#
# Requires rsvg-convert (brew install librsvg) and iconutil (macOS built-in).
# The last two are full-bleed: iOS and Android both apply their own mask, so
# they get a square filled edge to edge instead of the padded rounded rect.
#
# Requires rsvg-convert (brew install librsvg), magick (brew install imagemagick)
# and iconutil (macOS built-in).
# This script does NOT touch electron-builder config — it only rewrites the
# files that config already points at.
set -euo pipefail

cd "$(dirname "$0")/.."
SRC=resources/icon.svg

for bin in rsvg-convert iconutil; do
for bin in rsvg-convert iconutil magick; do
command -v "$bin" >/dev/null || { echo "missing $bin" >&2; exit 1; }
done

# Flattening onto the same colour the rounded rect is filled with is what makes
# the corners disappear, so read it from the artwork rather than restating it.
BG=$(sed -n 's/.*<rect[^>]*fill="\([^"]*\)".*/\1/p' "$SRC" | head -1)

png() { rsvg-convert -w "$2" -h "$2" "$SRC" -o "$1"; echo " $1 ${2}x${2}"; }
png_fullbleed() {
rsvg-convert -w "$2" -h "$2" "$SRC" | magick - -background "$BG" -flatten "$1"
echo " $1 ${2}x${2} full-bleed"
}

echo "app icons"
png resources/icon.png 1024
Expand All @@ -44,4 +59,9 @@ echo "site icons"
png site/public/icon.png 512
png site/public/apple-touch-icon.png 180

echo "web client icons"
png src/web-client/public/icon.png 1024
png_fullbleed src/web-client/public/icon-maskable.png 1024
png_fullbleed src/web-client/public/apple-touch-icon.png 1024

echo "done"
Binary file modified src/web-client/public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/web-client/public/icon-maskable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/web-client/public/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading