Files
Ferrous-Solitaire/scripts/gen_classic_pngs.sh
T
funman300 7238ef225e
Build and Deploy / build-and-push (push) Successful in 26s
feat(web): replace dark-theme card PNGs with classic (white) theme
Rasterized all 52 classic SVGs via rsvg-convert at 256×384. The web
game was showing dark-background cards; it now shows the traditional
white card face style.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 16:51:27 -07:00

34 lines
1.0 KiB
Bash

#!/usr/bin/env bash
# Rasterize the classic SVG theme into the web game's card PNG assets.
set -euo pipefail
CLASSIC="solitaire_engine/assets/themes/classic"
OUT="assets/cards/faces"
BACKS_OUT="assets/cards/backs"
declare -A SUIT=([clubs]=C [diamonds]=D [hearts]=H [spades]=S)
declare -A RANK=([ace]=A [2]=2 [3]=3 [4]=4 [5]=5 [6]=6 [7]=7 [8]=8 [9]=9 [10]=10 [jack]=J [queen]=Q [king]=K)
mkdir -p "$OUT" "$BACKS_OUT"
for svg in "$CLASSIC"/*_*.svg; do
base=$(basename "$svg" .svg) # e.g. clubs_ace
suit_name="${base%%_*}" # clubs
rank_name="${base#*_}" # ace
suit_code="${SUIT[$suit_name]:-}"
rank_code="${RANK[$rank_name]:-}"
if [ -z "$suit_code" ] || [ -z "$rank_code" ]; then
echo "skip: $base"
continue
fi
out="$OUT/${rank_code}${suit_code}.png"
rsvg-convert -w 256 -h 384 "$svg" -o "$out"
echo " $base -> $out"
done
# Back
rsvg-convert -w 256 -h 384 "$CLASSIC/back.svg" -o "$BACKS_OUT/back_0.png"
echo " back -> $BACKS_OUT/back_0.png"
echo "Done."