summaryrefslogtreecommitdiff
path: root/import-svg-assets.sh
blob: 19f09238b634d27d4bd705ca5c20a2d88b996623 (plain)
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
#!/bin/bash
#
# This file is part of GNU Taler
# (C) 2024 Taler Systems S.A.
#
# GNU Taler is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 3, or (at your option) any later version.
#
# GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
#

# To get the s2v command, do this:
#
# $ npm install svg2vectordrawable -g
#

ASSETS_DIR="../taler-assets/svg"
TMP_DIR="../taler-assets/s2v-tmp"
OUTPUT_DIR="./wallet/src/main/res/drawable/"

set -ex

mkdir -p "$TMP_DIR"

for d in "$ASSETS_DIR"/*; do
  s2v --folder="$d" --output="$TMP_DIR" --tint="?attr/colorControlNormal"
done

# remove unneeded icons
rm "$TMP_DIR/taler_logo_2021_plain.xml"
rm "$TMP_DIR/taler_logo_2022.xml"
rm "$TMP_DIR/logo_2021.xml"

# add tint
sed -i 's@android:viewportWidth@android:tint="?attr/colorControlNormal"\n    android:viewportWidth@g' "$TMP_DIR"/*.xml
# reduce size
sed -i 's@"1200dp"@"24dp"@g' "$TMP_DIR"/*.xml
# add path fillColor
sed -i 's@<path@<path\n        android:fillColor="#FF000000"@g' "$TMP_DIR"/*.xml

# move final files
mv "$TMP_DIR"/*.xml "$OUTPUT_DIR"

# remove tmp dir
rm -rf "$TMP_DIR"