Switch to rsvg-convert for mdi generation (#3734)

This commit is contained in:
Joakim Sørensen 2022-10-04 16:52:20 +02:00 committed by GitHub
parent 92c982435d
commit fe301f5063
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 22 deletions

View file

@ -1,5 +1,9 @@
#!/usr/bin/env bash
if ! [ -x "$(command -v rsvg-convert)" ]; then
apt install -y librsvg2-bin
fi
# Copy folder, without symlinks, but use actual files instead
mkdir -p build/_
mkdir -p build/brands
@ -21,30 +25,22 @@ find ./build -type f -name "icon.txt" | while read icon; do
dir=$(dirname "${icon}")
mdi=$(<${icon})
mdi="${mdi##mdi:}"
mogrify \
-format png \
-density 6400 \
-background transparent \
-fill "rgb(0,171,248,1.0)" \
-opaque black \
-trim \
-resize 240x240 \
-gravity center \
-extent 256x256 \
-write "${dir}/icon.png" \
rsvg-convert \
--stylesheet scripts/mdi.css \
--keep-aspect-ratio \
--height 256 \
--width 256 \
--background-color transparent \
--output "${dir}/icon.png" \
"mdi/svg/${mdi}.svg"
mogrify \
-format png \
-density 6400 \
-background transparent \
-fill "rgb(0,171,248,1.0)" \
-opaque black \
-trim \
-resize 480x480 \
-gravity center \
-extent 512x512 \
-write "${dir}/icon@2x.png" \
rsvg-convert \
--stylesheet scripts/mdi.css \
--keep-aspect-ratio \
--height 512 \
--width 512 \
--background-color transparent \
--output "${dir}/icon@2x.png" \
"mdi/svg/${mdi}.svg"
optipng -silent "${dir}/icon.png" "${dir}/icon@2x.png"

3
scripts/mdi.css Normal file
View file

@ -0,0 +1,3 @@
svg {
fill: rgb(0,171,248,1.0);
}