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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
|
#!/bin/bash
# Used to generate some icons
# Requires inkscape and imagemagick pacages
ICODIR=./icons/ # Directory with icons
SI_FRAMES=12 # Number of animation frames for status icon
for size in 16 24 32 ; do
# Rotating 'syncing' status icon is generated from multilayer svg
inkscape ${ICODIR}/si-syncthing.svg --export-id-only \
--export-area-page \
--export-id=background \
--export-png=/tmp/si-syncthing-back-${size}.png \
--export-width=${size} --export-height=${size}
# Generate default icon for each rotation
# for i in $(seq 0 $((SI_FRAMES-1))) ; do
for i in 0 ; do
echo si-syncthing-${i}.png
inkscape ${ICODIR}/si-syncthing.svg --export-id-only \
--export-area-page \
--export-id=rot${i} \
--export-png=/tmp/si-syncthing-${size}-${i}.png \
--export-width=${size} --export-height=${size}
convert \
/tmp/si-syncthing-back-${size}.png \
/tmp/si-syncthing-${size}-${i}.png \
-gravity center -compose over -composite \
${ICODIR}/${size}x${size}/status/si-syncthing-${i}.png
done
# Generate icon for idle state, unknown/offline state and warning state
echo si-syncthing-idle.png
convert \
/tmp/si-syncthing-back-${size}.png \
/tmp/si-syncthing-${size}-0.png \
-gravity center -compose over -composite \
${ICODIR}/${size}x${size}/status/si-syncthing-idle.png
echo si-syncthing-unknown.png
convert \
/tmp/si-syncthing-back-${size}.png \
/tmp/si-syncthing-${size}-0.png \
-gravity center -compose over -composite \
-colorspace Gray \
${ICODIR}/${size}x${size}/status/si-syncthing-unknown.png
echo si-syncthing-warning.png
inkscape ${ICODIR}/si-syncthing.svg --export-id-only \
--export-area-page \
--export-id=warning \
--export-png=/tmp/si-syncthing-warning-${size}.png \
--export-width=${size} --export-height=${size}
convert \
${ICODIR}/${size}x${size}/status/si-syncthing-idle.png \
/tmp/si-syncthing-warning-${size}.png \
-gravity center -compose over -composite \
${ICODIR}/${size}x${size}/status/si-syncthing-warning.png
# Generate black & white icons
for cols in "background-black rot black" "background-white rotblack white" ; do
cols=($cols)
inkscape ${ICODIR}/si-syncthing.svg --export-id-only \
--export-area-page \
--export-id=${cols[0]} \
--export-png=/tmp/si-syncthing-back-${size}.png \
--export-width=${size} --export-height=${size}
# Generate icon for each rotation
for i in $(seq 0 $((SI_FRAMES-1))) ; do
echo si-syncthing-${cols[2]}-${i}.png
inkscape ${ICODIR}/si-syncthing.svg --export-id-only \
--export-area-page \
--export-id=${cols[1]}${i} \
--export-png=/tmp/si-syncthing-${size}-${i}.png \
--export-width=${size} --export-height=${size}
convert \
/tmp/si-syncthing-back-${size}.png \
/tmp/si-syncthing-${size}-${i}.png \
-gravity center -compose over -composite \
${ICODIR}/${size}x${size}/status/si-syncthing-${cols[2]}-${i}.png
done
# Generate icon for idle state, unknown/offline state and warning state
echo si-syncthing-${cols[2]}-idle.png
convert \
/tmp/si-syncthing-back-${size}.png \
/tmp/si-syncthing-${size}-0.png \
-gravity center -compose over -composite \
${ICODIR}/${size}x${size}/status/si-syncthing-${cols[2]}-idle.png
echo si-syncthing-${cols[2]}-unknown.png
inkscape ${ICODIR}/si-syncthing.svg --export-id-only \
--export-area-page \
--export-id=${cols[1]}-unknown \
--export-png=/tmp/si-syncthing-${size}-unknown.png \
--export-width=${size} --export-height=${size}
convert \
/tmp/si-syncthing-back-${size}.png \
/tmp/si-syncthing-${size}-unknown.png \
-gravity center -compose over -composite \
-colorspace Gray \
${ICODIR}/${size}x${size}/status/si-syncthing-${cols[2]}-unknown.png
echo si-syncthing-${cols[2]}-warning.png
convert \
${ICODIR}/${size}x${size}/status/si-syncthing-${cols[2]}-idle.png \
/tmp/si-syncthing-warning-${size}.png \
-gravity center -compose over -composite \
${ICODIR}/${size}x${size}/status/si-syncthing-${cols[2]}-warning.png
done
done
|