diff --git a/assets/android-icon-foreground.png b/assets/android-icon-foreground.png index 7c5ebc3..330c46e 100644 Binary files a/assets/android-icon-foreground.png and b/assets/android-icon-foreground.png differ diff --git a/assets/android-icon-monochrome.png b/assets/android-icon-monochrome.png index ae51146..3855cd2 100644 Binary files a/assets/android-icon-monochrome.png and b/assets/android-icon-monochrome.png differ diff --git a/assets/icon.png b/assets/icon.png index ed0b5ee..300456e 100644 Binary files a/assets/icon.png and b/assets/icon.png differ diff --git a/assets/splash-icon.png b/assets/splash-icon.png index 45973e1..a759438 100644 Binary files a/assets/splash-icon.png and b/assets/splash-icon.png differ diff --git a/scripts/generate_icons.sh b/scripts/generate_icons.sh index be04124..d3e7c6a 100755 --- a/scripts/generate_icons.sh +++ b/scripts/generate_icons.sh @@ -1,7 +1,11 @@ #!/usr/bin/env bash # Generates all icon assets for bincio-rec. -# Requires ImageMagick (magick / convert). -# Style mirrors bincio_autarchive: dark background, white B, accent-coloured R. +# Requires ImageMagick 7 (magick). +# +# Centering strategy: both letters are rendered with -gravity Center. +# Each letter's centre is offset ±HALF pixels from the canvas centre, +# where HALF = (letter_width + gap) / 2. This gives mathematically +# correct horizontal & vertical centering regardless of font metrics. set -e cd "$(dirname "$0")/.." @@ -11,33 +15,37 @@ BG="#09090b" WHITE="#ffffff" RED="#ef4444" -# ── Main icon (1024×1024) ───────────────────────────────────────────────────── -magick -size 1024x1024 xc:"$BG" \ - -font "$FONT" \ - -pointsize 480 -fill "$WHITE" -gravity NorthWest -annotate +110+295 'B' \ - -pointsize 480 -fill "$RED" -gravity NorthWest -annotate +560+295 'R' \ - assets/icon.png +# render_br CANVAS BG SIZE HALF OUT +# HALF = how many pixels each letter centre is offset from canvas centre. +render_br() { + local CANVAS=$1 BG_COL=$2 SIZE=$3 HALF=$4 OUT=$5 + magick -size "${CANVAS}x${CANVAS}" xc:"$BG_COL" \ + -font "$FONT" -pointsize "$SIZE" -gravity Center \ + -fill "$WHITE" -annotate "-${HALF}+0" 'B' \ + -fill "$RED" -annotate "+${HALF}+0" 'R' \ + "$OUT" +} -# ── Android adaptive icon — foreground (transparent bg, design fits safe zone) -# Safe zone = inner 66% of 1024 = 676 px. -magick -size 1024x1024 xc:none \ - -font "$FONT" \ - -pointsize 340 -fill "$WHITE" -gravity NorthWest -annotate +175+325 'B' \ - -pointsize 340 -fill "$RED" -gravity NorthWest -annotate +535+325 'R' \ - assets/android-icon-foreground.png +# render_br_transparent CANVAS SIZE HALF B_FILL R_FILL OUT +render_br_transparent() { + local CANVAS=$1 SIZE=$2 HALF=$3 B_FILL=$4 R_FILL=$5 OUT=$6 + magick -size "${CANVAS}x${CANVAS}" xc:none \ + -font "$FONT" -pointsize "$SIZE" -gravity Center \ + -fill "$B_FILL" -annotate "-${HALF}+0" 'B' \ + -fill "$R_FILL" -annotate "+${HALF}+0" 'R' \ + "$OUT" +} -# ── Android adaptive icon — monochrome (white on transparent, for themed icons) -magick -size 1024x1024 xc:none \ - -font "$FONT" \ - -pointsize 340 -fill "$WHITE" -gravity NorthWest -annotate +175+325 'B' \ - -pointsize 340 -fill "$WHITE" -gravity NorthWest -annotate +535+325 'R' \ - assets/android-icon-monochrome.png +# At 480 pt NotoSans-Bold, each capital is ~320 px wide. +# Gap between inner edges: 60 px. Inter-centre: 320 + 60 = 380 → HALF = 190. +render_br 1024 "$BG" 480 190 assets/icon.png -# ── Splash screen icon (512×512) ───────────────────────────────────────────── -magick -size 512x512 xc:"$BG" \ - -font "$FONT" \ - -pointsize 240 -fill "$WHITE" -gravity NorthWest -annotate +55+147 'B' \ - -pointsize 240 -fill "$RED" -gravity NorthWest -annotate +280+147 'R' \ - assets/splash-icon.png +# Adaptive foreground (transparent, fits the 66% safe zone). +# 320 pt → letter ~215 px wide. Gap 50 px → HALF = 132. +render_br_transparent 1024 320 132 "$WHITE" "$RED" assets/android-icon-foreground.png +render_br_transparent 1024 320 132 "$WHITE" "$WHITE" assets/android-icon-monochrome.png + +# Splash 512×512 — 240 pt → letter ~160 px wide. Gap 36 px → HALF = 98. +render_br 512 "$BG" 240 98 assets/splash-icon.png echo "✓ Icon assets generated in assets/"