-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-logo
executable file
·135 lines (111 loc) · 2.45 KB
/
build-logo
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/sh -e
#
# Build the variants of the perfSONAR logo
#
OUTDIR="$1"
#
# SVG Variants
#
for VARIANT in logo powered icon
do
BASE_FILENAME="${OUTDIR}/perfsonar-${VARIANT}"
case "${VARIANT}" in
icon)
BASE_FILE="parts-icon.svg"
BASE_PARAMS="--param icon 1"
;;
logo)
BASE_FILE="parts-text.svg"
BASE_PARAMS="--param icon 1 --param text 1"
;;
powered)
BASE_FILE="parts.svg"
BASE_PARAMS="--param icon 1 --param text 1 --param powered 1"
;;
*)
echo "INTENRAL ERROR: Unsupported variant"
exit 1
;;
esac
for COLOR in black white
do
for FILL in empty full transparent
do
case "${FILL}" in
empty)
PARAMS="${BASE_PARAMS} --param icon_fill 0"
;;
full|transparent)
PARAMS="${BASE_PARAMS} --param icon_fill 1"
;;
*)
echo "INTENRAL ERROR: Unsupported fill"
exit 1
;;
esac
FILENAME="${BASE_FILENAME}-${COLOR}-${FILL}.svg"
xsltproc -o "${FILENAME}" ${PARAMS} parts.xslt "${BASE_FILE}"
# Apply color and transparency changes
case "${COLOR}" in
black)
true # Default is black
;;
white)
#sed -i -e 's/\([";]\)stroke:#000000/\1stroke:#ffffff/g' "${FILENAME}"
sed -i \
-e 's/fill:#000000;fill-opacity:1/fill:#ffffff;fill-opacity:1/g' \
-e 's/stroke:#000000;stroke-width:/stroke:#ffffff;stroke-width:/g' \
"${FILENAME}"
;;
*)
echo "INTENRAL ERROR: Unsupported color"
exit 1
;;
esac
case "${FILL}" in
empty|full)
true
;;
transparent)
sed -i -e 's/\([";]\)fill:#31b63f;fill-opacity:1/\1fill:#31b63f;fill-opacity:0.75/g' "${FILENAME}"
;;
*)
echo "INTENRAL ERROR: Unsupported fill"
exit 1
;;
esac
done
done
done
#
# PNGs
#
for FILE in $(find "${OUTDIR}" -name "*.svg")
do
OUTBASE=$(echo "${FILE}" | sed -e 's/\.[^.]*$//')
for SIZE in 25 50 100 200 400 1000 2000 4000
do
OUTFILE="${OUTBASE}-${SIZE}.png"
inkscape \
--export-png="${OUTFILE}" \
--export-height="${SIZE}" \
"${FILE}"
done
done
#
# Favicon
#
FAVICON_PNG="${OUTDIR}/favicon.png"
inkscape \
--export-png="${FAVICON_PNG}" \
--export-height="16" \
--export-width="16" \
--export-background=#ffffff \
"${OUTDIR}/perfsonar-icon-black-full.svg"
convert \
-density 256x256 \
"${FAVICON_PNG}" \
-define icon:auto-resize="16,16" \
-colors 256 \
"${OUTDIR}/favicon.ico"
rm -f "${FAVICON_PNG}"