-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·83 lines (69 loc) · 2.06 KB
/
build.sh
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env bash
set -e
SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")"
declare -a THEMES=(
ePapirus
Papirus
Papirus-Dark
Papirus-Light
)
: "${DEST_DIR:=$SCRIPT_DIR}"
: "${SRC_DIR:=$SCRIPT_DIR/src}"
: "${BUILD_DIR:=$SCRIPT_DIR/build}"
for theme in "${THEMES[@]}"; do
printf '=> Generate "%s" ...\n' "$theme" >&2
dest_theme_dir="$DEST_DIR/$theme"
build_theme_dir="$BUILD_DIR/$theme"
rm -rf "$build_theme_dir" "$dest_theme_dir"
mkdir -p "$build_theme_dir" "$dest_theme_dir"
cp -R "$SRC_DIR"/* "$build_theme_dir"
case "$theme" in
ePapirus)
theme_name="$theme"
find "$build_theme_dir" -type f -name '*.svg' -exec sed -i \
-e 's/#dfdfdf/#ffffff/gI' \
-e 's/#444444/#6e6e6e/gI' \
-e 's/#4285f4/#4285f4/gI' '{}' \;
;;
Papirus)
theme_name="$theme"
find "$build_theme_dir" -type f -name '*.svg' -exec sed -i \
-e 's/#dfdfdf/#dfdfdf/gI' \
-e 's/#444444/#444444/gI' \
-e 's/#4285f4/#4285f4/gI' '{}' \;
;;
Papirus-Dark)
theme_name="$theme"
find "$build_theme_dir" -type f -name '*.svg' -exec sed -i \
-e 's/#dfdfdf/#dfdfdf/gI' \
-e 's/#444444/#dfdfdf/gI' \
-e 's/#4285f4/#4285f4/gI' '{}' \;
;;
Papirus-Light)
theme_name="$theme"
find "$build_theme_dir" -type f -name '*.svg' -exec sed -i \
-e 's/#dfdfdf/#444444/gI' \
-e 's/#444444/#444444/gI' \
-e 's/#4285f4/#4285f4/gI' '{}' \;
;;
esac
# Create README.txt
cat > "$dest_theme_dir/README.txt" <<-EOF
${theme_name} theme for Claws Mail
Author: Alexey Varfolomeev <https://github.com/varlesh>
Homepage: https://github.com/PapirusDevelopmentTeam/papirus-claws-mail-theme
License: GPL-3.0
EOF
# Create .claws_themeinfo
cat > "$dest_theme_dir/.claws_themeinfo" <<-EOF
${theme_name}
Alexey Varfolomeev
https://github.com/PapirusDevelopmentTeam/papirus-claws-mail-theme
EOF
# Convert to bitmap images
find "$build_theme_dir" -name '*.svg' | while read -r file; do
bitmap_file="$dest_theme_dir/$(basename -s .svg "$file").png"
printf 'Converting "%s" -> "%s"\n' "$file" "$bitmap_file" >&2
rsvg-convert -f png "$file" -o "$bitmap_file"
done
done