Files

71 lines
2.5 KiB
Bash
Raw Permalink Normal View History

2026-09-14 15:31:20 -05:00
#!/usr/bin/env bash
# ---------------------------------------------------------------------------
# Generate Catppuccin Macchiato wallpapers with ImageMagick.
# Shipping binary images in a config repo is rude, so we synthesise them.
# usage: make-wallpaper.sh [output-dir] [WIDTHxHEIGHT]
# ---------------------------------------------------------------------------
set -euo pipefail
OUT_DIR="${1:-${XDG_DATA_HOME:-$HOME/.local/share}/wallpapers}"
GEOM="${2:-3840x2160}"
W="${GEOM%x*}"
H="${GEOM#*x}"
# ImageMagick 7 uses `magick`; 6 uses `convert`.
if command -v magick >/dev/null 2>&1; then IM=(magick)
elif command -v convert >/dev/null 2>&1; then IM=(convert)
else
echo "make-wallpaper: ImageMagick not found — skipping wallpaper generation" >&2
exit 0
fi
mkdir -p "$OUT_DIR"
base="#24273a"
mantle="#1e2030"
crust="#181926"
mauve="#c6a0f6"
blue="#8aadf4"
teal="#8bd5ca"
pink="#f5bde6"
# --- 1. soft diagonal gradient --------------------------------------------
"${IM[@]}" -size "${W}x${H}" \
"gradient:${mantle}-${crust}" \
-rotate 45 -gravity center -extent "${W}x${H}" \
-blur 0x24 \
"$OUT_DIR/macchiato-gradient.png"
# --- 2. radial glow over the base colour ----------------------------------
"${IM[@]}" -size "${W}x${H}" "xc:${base}" \
\( -size "${W}x${H}" "radial-gradient:${mauve}-${base}" -alpha set -channel A -evaluate multiply 0.22 +channel \) \
-compose over -composite \
\( -size "${W}x${H}" "radial-gradient:${teal}-${base}" -alpha set -channel A -evaluate multiply 0.12 +channel -roll +$((W/3))+$((H/3)) \) \
-compose over -composite \
-blur 0x40 \
"$OUT_DIR/macchiato-glow.png"
# --- 3. subtle triangle/mosaic texture ------------------------------------
"${IM[@]}" -size "$((W/12))x$((H/12))" "xc:${base}" \
+noise Gaussian -blur 0x2 -normalize \
-level 40%,60% \
-fill "${base}" -colorize 82% \
-resize "${W}x${H}!" -blur 0x3 \
"$OUT_DIR/macchiato-texture.png"
# --- 4. flat base, for people who want zero distraction -------------------
"${IM[@]}" -size "${W}x${H}" "xc:${base}" "$OUT_DIR/macchiato-flat.png"
# --- 5. logo-ish centred mark on the gradient -----------------------------
"${IM[@]}" "$OUT_DIR/macchiato-gradient.png" \
-gravity center \
-fill "${mauve}" -stroke none \
-draw "circle $((W/2)),$((H/2)) $((W/2)),$((H/2 - H/9))" \
-fill "${base}" \
-draw "circle $((W/2)),$((H/2)) $((W/2)),$((H/2 - H/9 + H/90))" \
-blur 0x1 \
"$OUT_DIR/macchiato-ring.png"
echo "wallpapers written to $OUT_DIR:"
ls -1 "$OUT_DIR"