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.44 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 "$INKSCAPE" --help | grep -e "--export-filename" > /dev/null; then
9
EXPORT_FILE_OPTION="--export-filename"
10
elif "$INKSCAPE" --help | grep -e "--export-file" > /dev/null; then
11
EXPORT_FILE_OPTION="--export-file"
12
elif "$INKSCAPE" --help | grep -e "--export-png" > /dev/null; then
13
EXPORT_FILE_OPTION="--export-png"
14
fi
15
16
SRC_FILE="assets.svg"
17
ASSETS_DIR="assets"
18
19
i="$1"
20
21
echo "Rendering '$ASSETS_DIR/$i.png'"
22
if [[ -n "${RENDER_SVG}" ]]; then
23
"$RENDER_SVG" --export-id "$i" \
24
"$SRC_FILE" "$ASSETS_DIR/$i.png"
25
else
26
"$INKSCAPE" --export-id="$i" \
27
--export-id-only \
28
"$EXPORT_FILE_OPTION"="$ASSETS_DIR/$i.png" "$SRC_FILE" >/dev/null
29
fi
30
if [[ -n "${OPTIPNG}" ]]; then
31
"$OPTIPNG" -o7 --quiet "$ASSETS_DIR/$i.png"
32
fi
33
34
echo "Rendering '$ASSETS_DIR/$i@2.png'"
35
if [[ -n "${RENDER_SVG}" ]]; then
36
# @TODO: remove --zoom when it will be fixed/implemented in resvg
37
"$RENDER_SVG" --export-id "$i" \
38
--dpi 192 \
39
--zoom 2 \
40
"$SRC_FILE" "$ASSETS_DIR/$i@2.png"
41
else
42
"$INKSCAPE" --export-id="$i" \
43
--export-id-only \
44
--export-dpi=192 \
45
"$EXPORT_FILE_OPTION"="$ASSETS_DIR/$i@2.png" "$SRC_FILE" >/dev/null
46
fi
47
if [[ -n "${OPTIPNG}" ]]; then
48
"$OPTIPNG" -o7 --quiet "$ASSETS_DIR/$i@2.png"
49
fi
50