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.02 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 [[ "$1" == "dark" ]]; then
9
SRC_FILE="assets-dark.svg"
10
ASSETS_DIR="assets-dark"
11
else
12
SRC_FILE="assets.svg"
13
ASSETS_DIR="assets"
14
fi
15
16
i="$2"
17
18
# @TODO: remove $ZOOM when it will be fixed/implemented in resvg
19
GTK2_HIDPI="$(echo "${GTK2_HIDPI-False}" | tr '[:upper:]' '[:lower:]')"
20
if [[ "${GTK2_HIDPI}" == "true" ]] ; then
21
DPI=192
22
ZOOM=2
23
else
24
DPI=96
25
ZOOM=1
26
fi
27
28
echo "Rendering '$ASSETS_DIR/$i.png'"
29
if [[ -n "${RENDER_SVG}" ]] ; then
30
# @TODO: remove --zoom when it will be fixed/implemented in resvg
31
"$RENDER_SVG" --export-id "$i" \
32
--dpi ${DPI} \
33
--zoom ${ZOOM} \
34
"$SRC_FILE" "$ASSETS_DIR/$i.png"
35
else
36
"$INKSCAPE" --export-id="$i" \
37
--export-id-only \
38
--export-dpi=${DPI} \
39
--export-png="$ASSETS_DIR/$i.png" "$SRC_FILE" >/dev/null
40
fi
41
42
if [[ -n "${OPTIPNG}" ]] ; then
43
"$OPTIPNG" -o7 --quiet "$ASSETS_DIR/$i.png"
44
fi
45