blob: 5e853849bd85c90be6635bb7e7e49cc55a0d14bb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#!/bin/bash
# Create simple preview images for themes using ImageMagick if available
# Falls back to creating placeholder files if ImageMagick is not installed
THEMES_DIR="/home/paul/git/gemtexter/extras/html/themes"
SCREENSHOTS_DIR="$THEMES_DIR/screenshots"
# Create screenshots directory if it doesn't exist
mkdir -p "$SCREENSHOTS_DIR"
# Check if ImageMagick is available
if command -v convert &> /dev/null; then
echo "ImageMagick found, creating preview images..."
# Generate preview for each theme
for theme_dir in "$THEMES_DIR"/*; do
if [ -d "$theme_dir" ] && [ "$theme_dir" != "$SCREENSHOTS_DIR" ]; then
theme_name=$(basename "$theme_dir")
# Skip non-theme directories
if [[ "$theme_name" == "screenshots" ]] || [[ "$theme_name" == *".py" ]] || [[ "$theme_name" == *".sh" ]] || [[ "$theme_name" == *".html" ]]; then
continue
fi
echo "Creating preview for $theme_name..."
# Create a simple preview image with theme name
convert -size 400x300 \
-background '#f0f0f0' \
-fill '#333333' \
-gravity center \
-pointsize 24 \
-font Arial \
label:"$theme_name\n\nTheme Preview" \
"$SCREENSHOTS_DIR/${theme_name}.png"
fi
done
echo "Preview images created!"
else
echo "ImageMagick not found. Creating placeholder files..."
# Create placeholder files
for theme_dir in "$THEMES_DIR"/*; do
if [ -d "$theme_dir" ] && [ "$theme_dir" != "$SCREENSHOTS_DIR" ]; then
theme_name=$(basename "$theme_dir")
# Skip non-theme directories
if [[ "$theme_name" == "screenshots" ]] || [[ "$theme_name" == *".py" ]] || [[ "$theme_name" == *".sh" ]] || [[ "$theme_name" == *".html" ]]; then
continue
fi
# Create an empty placeholder file
touch "$SCREENSHOTS_DIR/${theme_name}.png"
fi
done
echo "Placeholder files created. To generate actual previews, install ImageMagick:"
echo " sudo apt install imagemagick # Debian/Ubuntu"
echo " sudo dnf install ImageMagick # Fedora"
echo " brew install imagemagick # macOS"
fi
echo "Done! Preview files are in $SCREENSHOTS_DIR"
|