diff options
author | Torsten Grote <t@grobox.de> | 2024-04-24 11:54:17 -0300 |
---|---|---|
committer | Torsten Grote <t@grobox.de> | 2024-04-24 11:54:17 -0300 |
commit | efec0b32f665d28af3d04e46467d4d318d07db12 (patch) | |
tree | 20ceb7276546b34412973aff5ae2a00e7b53a9af | |
parent | 6738c6a03b87be9252e39a7236fed4f91505bb58 (diff) | |
download | taler-android-efec0b32f665d28af3d04e46467d4d318d07db12.tar.gz taler-android-efec0b32f665d28af3d04e46467d4d318d07db12.tar.bz2 taler-android-efec0b32f665d28af3d04e46467d4d318d07db12.zip |
Add script for importing SVG assets
and transformation to Android vector drawables
-rwxr-xr-x | import-svg-assets.sh | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/import-svg-assets.sh b/import-svg-assets.sh new file mode 100755 index 0000000..19f0923 --- /dev/null +++ b/import-svg-assets.sh @@ -0,0 +1,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" |