|
| 1 | +#!/bin/bash |
| 2 | +# Generate Plymouth theme assets for Hypercube |
| 3 | +# This script creates the spinner frames and progress bar images |
| 4 | +# Requires: ImageMagick (convert), inkscape or rsvg-convert for SVG |
| 5 | + |
| 6 | +set -e |
| 7 | + |
| 8 | +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 9 | +THEME_DIR="$SCRIPT_DIR/hypercube" |
| 10 | + |
| 11 | +echo "Generating Hypercube Plymouth theme assets..." |
| 12 | + |
| 13 | +# Colors matching the neon hypercube theme |
| 14 | +PINK="#FF1493" |
| 15 | +BLUE="#00BFFF" |
| 16 | +PURPLE="#8A2BE2" |
| 17 | +BG_COLOR="#0a0a0f" |
| 18 | + |
| 19 | +# Create spinner frames (12 frames for smooth rotation) |
| 20 | +echo "Creating spinner frames..." |
| 21 | +for i in $(seq 0 11); do |
| 22 | + angle=$((i * 30)) |
| 23 | + |
| 24 | + # Create an SVG spinner frame with rotating dots |
| 25 | + cat > "$THEME_DIR/spinner-$i.svg" << EOF |
| 26 | +<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64"> |
| 27 | + <g transform="rotate($angle 32 32)"> |
| 28 | + <!-- 8 dots in a circle, with varying opacity --> |
| 29 | + <circle cx="32" cy="8" r="4" fill="$PINK" opacity="1.0"/> |
| 30 | + <circle cx="49" cy="15" r="4" fill="$PINK" opacity="0.875"/> |
| 31 | + <circle cx="56" cy="32" r="4" fill="$BLUE" opacity="0.75"/> |
| 32 | + <circle cx="49" cy="49" r="4" fill="$BLUE" opacity="0.625"/> |
| 33 | + <circle cx="32" cy="56" r="4" fill="$PURPLE" opacity="0.5"/> |
| 34 | + <circle cx="15" cy="49" r="4" fill="$PURPLE" opacity="0.375"/> |
| 35 | + <circle cx="8" cy="32" r="4" fill="$PINK" opacity="0.25"/> |
| 36 | + <circle cx="15" cy="15" r="4" fill="$PINK" opacity="0.125"/> |
| 37 | + </g> |
| 38 | +</svg> |
| 39 | +EOF |
| 40 | + |
| 41 | + # Convert SVG to PNG (try multiple converters) |
| 42 | + if command -v rsvg-convert &> /dev/null; then |
| 43 | + rsvg-convert -w 64 -h 64 "$THEME_DIR/spinner-$i.svg" -o "$THEME_DIR/spinner-$i.png" |
| 44 | + elif command -v inkscape &> /dev/null; then |
| 45 | + inkscape -w 64 -h 64 "$THEME_DIR/spinner-$i.svg" -o "$THEME_DIR/spinner-$i.png" 2>/dev/null |
| 46 | + elif command -v convert &> /dev/null; then |
| 47 | + convert -background none "$THEME_DIR/spinner-$i.svg" "$THEME_DIR/spinner-$i.png" |
| 48 | + else |
| 49 | + echo "Warning: No SVG converter found. Please install rsvg-convert, inkscape, or imagemagick" |
| 50 | + echo "Keeping SVG files for manual conversion" |
| 51 | + fi |
| 52 | +done |
| 53 | + |
| 54 | +# Create progress bar background |
| 55 | +echo "Creating progress bar..." |
| 56 | +cat > "$THEME_DIR/progress-bg.svg" << EOF |
| 57 | +<svg xmlns="http://www.w3.org/2000/svg" width="400" height="8" viewBox="0 0 400 8"> |
| 58 | + <rect x="0" y="0" width="400" height="8" rx="4" fill="#1a1a2e" stroke="$PURPLE" stroke-width="1"/> |
| 59 | +</svg> |
| 60 | +EOF |
| 61 | + |
| 62 | +# Create progress bar foreground (gradient from pink to blue) |
| 63 | +cat > "$THEME_DIR/progress-fg.svg" << EOF |
| 64 | +<svg xmlns="http://www.w3.org/2000/svg" width="396" height="4" viewBox="0 0 396 4"> |
| 65 | + <defs> |
| 66 | + <linearGradient id="neonGrad" x1="0%" y1="0%" x2="100%" y2="0%"> |
| 67 | + <stop offset="0%" style="stop-color:$PINK;stop-opacity:1" /> |
| 68 | + <stop offset="50%" style="stop-color:$PURPLE;stop-opacity:1" /> |
| 69 | + <stop offset="100%" style="stop-color:$BLUE;stop-opacity:1" /> |
| 70 | + </linearGradient> |
| 71 | + </defs> |
| 72 | + <rect x="0" y="0" width="396" height="4" rx="2" fill="url(#neonGrad)"/> |
| 73 | +</svg> |
| 74 | +EOF |
| 75 | + |
| 76 | +# Convert progress bar SVGs to PNG |
| 77 | +if command -v rsvg-convert &> /dev/null; then |
| 78 | + rsvg-convert -w 400 -h 8 "$THEME_DIR/progress-bg.svg" -o "$THEME_DIR/progress-bg.png" |
| 79 | + rsvg-convert -w 396 -h 4 "$THEME_DIR/progress-fg.svg" -o "$THEME_DIR/progress-fg.png" |
| 80 | +elif command -v inkscape &> /dev/null; then |
| 81 | + inkscape -w 400 -h 8 "$THEME_DIR/progress-bg.svg" -o "$THEME_DIR/progress-bg.png" 2>/dev/null |
| 82 | + inkscape -w 396 -h 4 "$THEME_DIR/progress-fg.svg" -o "$THEME_DIR/progress-fg.png" 2>/dev/null |
| 83 | +elif command -v convert &> /dev/null; then |
| 84 | + convert -background none "$THEME_DIR/progress-bg.svg" "$THEME_DIR/progress-bg.png" |
| 85 | + convert -background none "$THEME_DIR/progress-fg.svg" "$THEME_DIR/progress-fg.png" |
| 86 | +fi |
| 87 | + |
| 88 | +# Convert background.webp to PNG if it exists and we have the tools |
| 89 | +BACKGROUND_SRC="$SCRIPT_DIR/../../dot_files/hypr/background.webp" |
| 90 | +if [ -f "$BACKGROUND_SRC" ]; then |
| 91 | + echo "Converting background image..." |
| 92 | + if command -v convert &> /dev/null; then |
| 93 | + convert "$BACKGROUND_SRC" "$THEME_DIR/background.png" |
| 94 | + elif command -v ffmpeg &> /dev/null; then |
| 95 | + ffmpeg -y -i "$BACKGROUND_SRC" "$THEME_DIR/background.png" 2>/dev/null |
| 96 | + else |
| 97 | + echo "Warning: Cannot convert background.webp - please install imagemagick or ffmpeg" |
| 98 | + echo "Or manually convert dot_files/hypr/background.webp to branding/plymouth/hypercube/background.png" |
| 99 | + fi |
| 100 | +fi |
| 101 | + |
| 102 | +# Create a simple logo placeholder if it doesn't exist |
| 103 | +if [ ! -f "$THEME_DIR/logo.png" ]; then |
| 104 | + echo "Creating placeholder logo..." |
| 105 | + cat > "$THEME_DIR/logo.svg" << EOF |
| 106 | +<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200"> |
| 107 | + <defs> |
| 108 | + <linearGradient id="cubeGrad" x1="0%" y1="0%" x2="100%" y2="100%"> |
| 109 | + <stop offset="0%" style="stop-color:$PINK;stop-opacity:1" /> |
| 110 | + <stop offset="100%" style="stop-color:$BLUE;stop-opacity:1" /> |
| 111 | + </linearGradient> |
| 112 | + <filter id="glow"> |
| 113 | + <feGaussianBlur stdDeviation="3" result="coloredBlur"/> |
| 114 | + <feMerge> |
| 115 | + <feMergeNode in="coloredBlur"/> |
| 116 | + <feMergeNode in="SourceGraphic"/> |
| 117 | + </feMerge> |
| 118 | + </filter> |
| 119 | + </defs> |
| 120 | + <!-- Outer cube (rotated 45 degrees) --> |
| 121 | + <g transform="translate(100,100) rotate(45)" filter="url(#glow)"> |
| 122 | + <rect x="-60" y="-60" width="120" height="120" fill="none" stroke="url(#cubeGrad)" stroke-width="4"/> |
| 123 | + </g> |
| 124 | + <!-- Text --> |
| 125 | + <text x="100" y="185" text-anchor="middle" font-family="sans-serif" font-size="16" fill="white" opacity="0.9">HYPERCUBE</text> |
| 126 | +</svg> |
| 127 | +EOF |
| 128 | + |
| 129 | + if command -v rsvg-convert &> /dev/null; then |
| 130 | + rsvg-convert -w 200 -h 200 "$THEME_DIR/logo.svg" -o "$THEME_DIR/logo.png" |
| 131 | + elif command -v inkscape &> /dev/null; then |
| 132 | + inkscape -w 200 -h 200 "$THEME_DIR/logo.svg" -o "$THEME_DIR/logo.png" 2>/dev/null |
| 133 | + elif command -v convert &> /dev/null; then |
| 134 | + convert -background none "$THEME_DIR/logo.svg" "$THEME_DIR/logo.png" |
| 135 | + fi |
| 136 | +fi |
| 137 | + |
| 138 | +# Clean up SVG files (optional - uncomment if you want to remove them) |
| 139 | +# rm -f "$THEME_DIR"/*.svg |
| 140 | + |
| 141 | +echo "Asset generation complete!" |
| 142 | +echo "" |
| 143 | +echo "Generated files in $THEME_DIR:" |
| 144 | +ls -la "$THEME_DIR"/*.png 2>/dev/null || echo " (PNG files will be generated when you run this script with proper tools installed)" |
| 145 | +echo "" |
| 146 | +echo "Required tools (in order of preference):" |
| 147 | +echo " - rsvg-convert (from librsvg2-tools)" |
| 148 | +echo " - inkscape" |
| 149 | +echo " - convert (from imagemagick)" |
| 150 | +echo "" |
| 151 | +echo "To install on Fedora: dnf install librsvg2-tools ImageMagick" |
0 commit comments