SVG icon set
git clone https://git.lucas.co/cce-icons.git
build.sh (1.3K)
1 #!/bin/bash
2
3 # Bake the SVG sources into fixed-size, single-color XPMs.
4 # NOTE: nothing in the cce workspace consumes these — the runtime path is
5 # cce_ui::upload_icon, which rasterizes the SVGs directly. This script is
6 # kept for any external consumer that wants pre-baked bitmaps; its output
7 # (./xpm) is untracked.
8
9 # Configuration
10 ICON_SIZE="40x40"
11 ICON_COLOR="#ae8593" # Mixed Pink and Green
12 SVG_DIR="./svg"
13 OUTPUT_DIR="./xpm"
14
15 # Ensure output directory exists
16 mkdir -p "$OUTPUT_DIR"
17
18 echo "✨ CCE Icons Builder"
19 echo "-----------------------"
20 echo "Target Color: $ICON_COLOR"
21
22 # Check for ImageMagick
23 if ! command -v magick &> /dev/null; then
24 echo "❌ Error: ImageMagick (magick) is not installed."
25 exit 1
26 fi
27
28 count=0
29
30 # Convert SVGs
31 for svg in "$SVG_DIR"/*.svg; do
32 [ -e "$svg" ] || continue
33 filename=$(basename -- "$svg")
34 name="${filename%.*}"
35 output="$OUTPUT_DIR/$name.xpm"
36 echo "🎨 Converting & Coloring: $filename -> $name.xpm"
37 # -fill + -colorize 100% applies the color while preserving alpha
38 magick -background none "$svg" -fill "$ICON_COLOR" -colorize 100% -resize "$ICON_SIZE" "$output"
39 ((count++))
40 done
41
42 if [ "$count" -eq 0 ]; then
43 echo "📭 No source files found."
44 else
45 echo "-----------------------"
46 echo "✅ Successfully converted $count icons to $OUTPUT_DIR"
47 fi