-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate.sh
executable file
·58 lines (41 loc) · 1.33 KB
/
generate.sh
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
#!/bin/bash
BACKGROUND_COLORS=(
"#F44336" "#E91E63" "#9C27B0" "#673AB7" "#3F51B5" "#2196F3" "#03A9F4"
"#00BCD4" "#795548" "#009688" "#4CAF50" "#8BC34A" "#CDDC39" "#FFEB3B"
"#FFC107" "#FF9800" "#FF5722" "#9E9E9E" "#607D8B"
);
CURRENT_DIR=$(cd "$( dirname "$0" )" && pwd);
LETTERS=(
"A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R"
"S" "T" "U" "V" "W" "X" "Y" "Z"
);
OUTPUT_DIR=$CURRENT_DIR/letters;
function main() {
rm -rf $OUTPUT_DIR
mkdir -p $OUTPUT_DIR
for backgroundColorIndex in ${!BACKGROUND_COLORS[@]};
do
backgroundColor=${BACKGROUND_COLORS[backgroundColorIndex]};
paddedBackgroundColorIndex=$(printf "%02d" $backgroundColorIndex);
for firstLetterIndex in ${!LETTERS[@]};
do
firstLetter=${LETTERS[firstLetterIndex]};
for secondLetterIndex in ${!LETTERS[@]};
do
secondLetter=${LETTERS[secondLetterIndex]};
generateLetterFiles $backgroundColor $backgroundColorIndex "${firstLetter}${secondLetter}" &
done;
wait
generateLetterFiles $backgroundColor $backgroundColorIndex $firstLetter &
done;
done;
}
function generateLetterFiles() {
sed "s/red/$1/g; s/LP/${3}/g" template.svg \
> $OUTPUT_DIR/${3}${2}.svg
toPNG $OUTPUT_DIR/${3}${2}.svg 64
}
function toPNG() {
convert -size ${2}x${2} $1 ${1%.svg}.png
}
main $@