A fork of the Materia GTK theme.

Important information: Google announced that, from September 2026, Android devices will require ALL apps to be signed by Google, effectively leading to an iOS situation. Value your right to a computer that does what you want; do not tolerate this monopolistic practice! Contact me if you don't understand why it is bad. Click to learn more.

 render-asset.sh

View raw Download
text/x-shellscript • 1.43 kiB
Bourne-Again shell script, ASCII text executable
        
            
1
#!/bin/bash
2
set -ueo pipefail
3
4
RENDER_SVG="$(command -v rendersvg)" || true
5
INKSCAPE="$(command -v inkscape)" || true
6
OPTIPNG="$(command -v optipng)" || true
7
8
if [[ -n "${INKSCAPE}" ]]; then
9
if "$INKSCAPE" --help | grep -e "--export-filename" > /dev/null; then
10
EXPORT_FILE_OPTION="--export-filename"
11
elif "$INKSCAPE" --help | grep -e "--export-file" > /dev/null; then
12
EXPORT_FILE_OPTION="--export-file"
13
elif "$INKSCAPE" --help | grep -e "--export-png" > /dev/null; then
14
EXPORT_FILE_OPTION="--export-png"
15
fi
16
fi
17
18
if [[ "$1" == "dark" ]]; then
19
SRC_FILE="assets-dark.svg"
20
ASSETS_DIR="assets-dark"
21
else
22
SRC_FILE="assets.svg"
23
ASSETS_DIR="assets"
24
fi
25
26
i="$2"
27
28
# @TODO: remove $ZOOM when it will be fixed/implemented in resvg
29
GTK2_HIDPI="$(echo "${GTK2_HIDPI-False}" | tr '[:upper:]' '[:lower:]')"
30
if [[ "${GTK2_HIDPI}" == "true" ]]; then
31
DPI=192
32
ZOOM=2
33
else
34
DPI=96
35
ZOOM=1
36
fi
37
38
echo "Rendering '$ASSETS_DIR/$i.png'"
39
40
if [[ -n "${RENDER_SVG}" ]]; then
41
# @TODO: remove --zoom when it will be fixed/implemented in resvg
42
"$RENDER_SVG" --export-id "$i" \
43
--dpi ${DPI} \
44
--zoom ${ZOOM} \
45
"$SRC_FILE" "$ASSETS_DIR/$i.png"
46
else
47
"$INKSCAPE" --export-id="$i" \
48
--export-id-only \
49
--export-dpi=${DPI} \
50
"$EXPORT_FILE_OPTION"="$ASSETS_DIR/$i.png" "$SRC_FILE" >/dev/null
51
fi
52
53
if [[ -n "${OPTIPNG}" ]]; then
54
"$OPTIPNG" -o7 --quiet "$ASSETS_DIR/$i.png"
55
fi
56