2 # Converts my logo to various formats from a template SVG
5 SIZES=(2048 1024 512 256 128 64)
6 A_SIZES=(10 15 20 25 30 35 40 45 50 55 60)
9 [[ -z ${arg} ]] && echo "Please provide an output format!" && exit 1
11 [[ ${arg} == "svg" ]] && find . -name *.svg -not -path "./template/*" \
14 if [[ (! -d "square/svg" || ! -d "circle/svg") || (${arg} == "svg") ]]; then
15 echo "Generating SVGs"
16 for SHAPE in square circle; do
17 mkdir -pv ${SHAPE}/svg
19 sed -e 's/STROKE/stroke="#00ffbf"/g' \
20 -e 's/FILL/#212121/g' template/${SHAPE}.svg \
21 > ${SHAPE}/svg/logo-${SHAPE}-color-dark.svg
23 sed -e 's/STROKE/stroke="#00ffbf"/g' \
24 -e 's/FILL/#fff/g' template/${SHAPE}.svg \
25 > ${SHAPE}/svg/logo-${SHAPE}-color-white.svg
27 sed -e 's/STROKE/stroke="#00ffbf"/g' \
28 -e 's/FILL/none/g' template/${SHAPE}.svg \
29 > ${SHAPE}/svg/logo-${SHAPE}-color-trans.svg
31 sed -e 's/STROKE/stroke="#212121"/g' \
32 -e 's/FILL/#00ffbf/g' template/${SHAPE}.svg \
33 > ${SHAPE}/svg/logo-${SHAPE}-dark-color.svg
35 sed -e 's/STROKE/stroke="#212121"/g' \
36 -e 's/FILL/#fff/g' template/${SHAPE}.svg \
37 > ${SHAPE}/svg/logo-${SHAPE}-dark-white.svg
39 sed -e 's/STROKE/stroke="#212121"/g' \
40 -e 's/FILL/none/g' template/${SHAPE}.svg \
41 > ${SHAPE}/svg/logo-${SHAPE}-dark-trans.svg
43 sed -e 's/STROKE/stroke="#fff"/g' \
44 -e 's/FILL/#00ffbf/g' template/${SHAPE}.svg \
45 > ${SHAPE}/svg/logo-${SHAPE}-white-color.svg
47 sed -e 's/STROKE/stroke="#fff"/g' \
48 -e 's/FILL/#212121/g' template/${SHAPE}.svg \
49 > ${SHAPE}/svg/logo-${SHAPE}-white-dark.svg
51 sed -e 's/STROKE/stroke="#fff"/g' \
52 -e 's/FILL/none/g' template/${SHAPE}.svg \
53 > ${SHAPE}/svg/logo-${SHAPE}-white-trans.svg
57 [[ ${arg} == "svg" ]] && exit 0
59 [[ ${arg} == "png" ]] && find . -name *.png -exec rm -v {} \;
61 if [[ (! -d "square/png" || ! -d "circle/png") || (${arg} == "png") ]]; then
62 echo "Generating PNGs"
63 for SHAPE in square circle; do
64 for i in ${SIZES[@]}; do
65 mkdir -pv ${SHAPE}/png/${i}
68 for i in ${SIZES[@]}; do
69 for SVGIN in square/svg/*; do
70 BASE=$(basename ${SVGIN} | cut -d '.' -f 1)
71 inkscape -w ${i} -h ${i} ${SVGIN} --export-filename \
72 square/png/${i}/${BASE}-${i}.png
75 for SVGIN in circle/svg/*; do
76 BASE=$(basename ${SVGIN} | cut -d '.' -f 1)
77 inkscape -w ${i} -h ${i} ${SVGIN} --export-filename \
78 circle/png/${i}/${BASE}-${i}.png
84 [[ ${arg} == "png" ]] && exit 0
86 if [[ ${arg} == "ascii" ]]; then
87 echo "Generating ASCII art"
88 find . -name *ascii.txt -exec rm -v {} \;
89 for SHAPE in square circle; do
90 for i in ${A_SIZES[@]}; do
91 mkdir -pv ${SHAPE}/ascii/${i}
93 for PNGIN in circle/png/2048/*; do
94 BASE=$(basename ${PNGIN} | cut -d '.' -f 1)
95 jp2a --height=${i} ${PNGIN} > circle/ascii/${i}/${BASE}-${i}.ascii.txt
98 for PNGIN in square/png/2048/*; do
99 BASE=$(basename ${PNGIN} | cut -d '.' -f 1)
100 jp2a --height=${i} ${PNGIN} > square/ascii/${i}/${BASE}-${i}.ascii.txt
107 if [[ ${arg} == "unicode" ]]; then
108 echo "Generating Unicode"
109 find . -name *unicode.txt -exec rm -v {} \;
110 for SHAPE in square circle; do
111 for i in ${A_SIZES[@]}; do
112 mkdir -pv ${SHAPE}/unicode/${i}
114 for PNGIN in circle/png/2048/*; do
115 BASE=$(basename ${PNGIN} | cut -d '-' -f -4)
116 chafa -c none -s ${i}x${i} ${PNGIN} \
117 > circle/unicode/${i}/${BASE}-${i}.unicode.txt
120 for PNGIN in square/png/2048/*; do
121 BASE=$(basename ${PNGIN} | cut -d '-' -f -4)
122 chafa -c none -s ${i}x${i} ${PNGIN} \
123 > square/unicode/${i}/${BASE}-${i}.unicode.txt
130 for SHAPE in square circle; do
131 find . -name *.${arg} -exec rm -v {} \;
133 for i in ${SIZES[@]}; do
134 mkdir -pv ${SHAPE}/${arg}/${i}
138 echo "Generating ${arg}s"
139 convert -verbose ${PAT} ${PAT//png/${arg}}
140 done < <(find -name *.png)