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.5 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
SRC_FILE="assets.svg"
19
ASSETS_DIR="assets"
20
21
i="$1"
22
23
echo "Rendering '$ASSETS_DIR/$i.png'"
24
25
if [[ -n "${RENDER_SVG}" ]]; then
26
"$RENDER_SVG" --export-id "$i" \
27
"$SRC_FILE" "$ASSETS_DIR/$i.png"
28
else
29
"$INKSCAPE" --export-id="$i" \
30
--export-id-only \
31
"$EXPORT_FILE_OPTION"="$ASSETS_DIR/$i.png" "$SRC_FILE" >/dev/null
32
fi
33
34
if [[ -n "${OPTIPNG}" ]]; then
35
"$OPTIPNG" -o7 --quiet "$ASSETS_DIR/$i.png"
36
fi
37
38
echo "Rendering '$ASSETS_DIR/$i@2.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 192 \
44
--zoom 2 \
45
"$SRC_FILE" "$ASSETS_DIR/$i@2.png"
46
else
47
"$INKSCAPE" --export-id="$i" \
48
--export-id-only \
49
--export-dpi=192 \
50
"$EXPORT_FILE_OPTION"="$ASSETS_DIR/$i@2.png" "$SRC_FILE" >/dev/null
51
fi
52
53
if [[ -n "${OPTIPNG}" ]]; then
54
"$OPTIPNG" -o7 --quiet "$ASSETS_DIR/$i@2.png"
55
fi
56