SIZES=(2048 1024 512 256 128 64)
A_SIZES=(10 15 20 25 30 35 40 45 50 55 60)
-[[ -z ${1} ]] && echo "Please provide an output format!" && exit 1
-
-[[ ${1} == "svg" ]] && find . -name *.svg -not -path "./template/*" -exec rm -v {} \;
-
-if [[ (! -d "square/svg" || ! -d "circle/svg") || (${1} == "svg") ]]; then
- echo "Generating SVGs"
- for SHAPE in square circle; do
- mkdir -pv ${SHAPE}/svg
-
- sed -e 's/STROKE/stroke="#00ffbf"/g' \
- -e 's/FILL/#212121/g' template/${SHAPE}.svg \
- > ${SHAPE}/svg/logo-${SHAPE}-color-dark.svg
-
- sed -e 's/STROKE/stroke="#00ffbf"/g' \
- -e 's/FILL/#fff/g' template/${SHAPE}.svg \
- > ${SHAPE}/svg/logo-${SHAPE}-color-white.svg
-
- sed -e 's/STROKE/stroke="#00ffbf"/g' \
- -e 's/FILL/none/g' template/${SHAPE}.svg \
- > ${SHAPE}/svg/logo-${SHAPE}-color-trans.svg
-
- sed -e 's/STROKE/stroke="#212121"/g' \
- -e 's/FILL/#00ffbf/g' template/${SHAPE}.svg \
- > ${SHAPE}/svg/logo-${SHAPE}-dark-color.svg
-
- sed -e 's/STROKE/stroke="#212121"/g' \
- -e 's/FILL/#fff/g' template/${SHAPE}.svg \
- > ${SHAPE}/svg/logo-${SHAPE}-dark-white.svg
-
- sed -e 's/STROKE/stroke="#212121"/g' \
- -e 's/FILL/none/g' template/${SHAPE}.svg \
- > ${SHAPE}/svg/logo-${SHAPE}-dark-trans.svg
-
- sed -e 's/STROKE/stroke="#fff"/g' \
- -e 's/FILL/#00ffbf/g' template/${SHAPE}.svg \
- > ${SHAPE}/svg/logo-${SHAPE}-white-color.svg
-
- sed -e 's/STROKE/stroke="#fff"/g' \
- -e 's/FILL/#212121/g' template/${SHAPE}.svg \
- > ${SHAPE}/svg/logo-${SHAPE}-white-dark.svg
-
- sed -e 's/STROKE/stroke="#fff"/g' \
- -e 's/FILL/none/g' template/${SHAPE}.svg \
- > ${SHAPE}/svg/logo-${SHAPE}-white-trans.svg
- done
-fi
-
-[[ ${1} == "svg" ]] && exit 0
-
-[[ ${1} == "png" ]] && find . -name *.png -exec rm -v {} \;
-
-if [[ (! -d "square/png" || ! -d "circle/png") || (${1} == "png") ]]; then
- echo "Generating PNGs"
- for SHAPE in square circle; do
- for i in ${SIZES[@]}; do
- mkdir -pv ${SHAPE}/png/${i}
+for arg in ${@};do
+ [[ -z ${arg} ]] && echo "Please provide an output format!" && exit 1
+
+ [[ ${arg} == "svg" ]] && find . -name *.svg -not -path "./template/*" \
+ -exec rm -v {} \;
+
+ if [[ (! -d "square/svg" || ! -d "circle/svg") || (${arg} == "svg") ]]; then
+ echo "Generating SVGs"
+ for SHAPE in square circle; do
+ mkdir -pv ${SHAPE}/svg
+
+ sed -e 's/STROKE/stroke="#00ffbf"/g' \
+ -e 's/FILL/#212121/g' template/${SHAPE}.svg \
+ > ${SHAPE}/svg/logo-${SHAPE}-color-dark.svg
+
+ sed -e 's/STROKE/stroke="#00ffbf"/g' \
+ -e 's/FILL/#fff/g' template/${SHAPE}.svg \
+ > ${SHAPE}/svg/logo-${SHAPE}-color-white.svg
+
+ sed -e 's/STROKE/stroke="#00ffbf"/g' \
+ -e 's/FILL/none/g' template/${SHAPE}.svg \
+ > ${SHAPE}/svg/logo-${SHAPE}-color-trans.svg
+
+ sed -e 's/STROKE/stroke="#212121"/g' \
+ -e 's/FILL/#00ffbf/g' template/${SHAPE}.svg \
+ > ${SHAPE}/svg/logo-${SHAPE}-dark-color.svg
+
+ sed -e 's/STROKE/stroke="#212121"/g' \
+ -e 's/FILL/#fff/g' template/${SHAPE}.svg \
+ > ${SHAPE}/svg/logo-${SHAPE}-dark-white.svg
+
+ sed -e 's/STROKE/stroke="#212121"/g' \
+ -e 's/FILL/none/g' template/${SHAPE}.svg \
+ > ${SHAPE}/svg/logo-${SHAPE}-dark-trans.svg
+
+ sed -e 's/STROKE/stroke="#fff"/g' \
+ -e 's/FILL/#00ffbf/g' template/${SHAPE}.svg \
+ > ${SHAPE}/svg/logo-${SHAPE}-white-color.svg
+
+ sed -e 's/STROKE/stroke="#fff"/g' \
+ -e 's/FILL/#212121/g' template/${SHAPE}.svg \
+ > ${SHAPE}/svg/logo-${SHAPE}-white-dark.svg
+
+ sed -e 's/STROKE/stroke="#fff"/g' \
+ -e 's/FILL/none/g' template/${SHAPE}.svg \
+ > ${SHAPE}/svg/logo-${SHAPE}-white-trans.svg
done
-
- for i in ${SIZES[@]}; do
- for SVGIN in square/svg/*; do
- BASE=$(basename ${SVGIN} | cut -d '.' -f 1)
- inkscape -w ${i} -h ${i} ${SVGIN} --export-filename \
- square/png/${i}/${BASE}-${i}.png
+ fi
+
+ [[ ${arg} == "svg" ]] && exit 0
+
+ [[ ${arg} == "png" ]] && find . -name *.png -exec rm -v {} \;
+
+ if [[ (! -d "square/png" || ! -d "circle/png") || (${arg} == "png") ]]; then
+ echo "Generating PNGs"
+ for SHAPE in square circle; do
+ for i in ${SIZES[@]}; do
+ mkdir -pv ${SHAPE}/png/${i}
done
-
- for SVGIN in circle/svg/*; do
- BASE=$(basename ${SVGIN} | cut -d '.' -f 1)
- inkscape -w ${i} -h ${i} ${SVGIN} --export-filename \
- circle/png/${i}/${BASE}-${i}.png
+
+ for i in ${SIZES[@]}; do
+ for SVGIN in square/svg/*; do
+ BASE=$(basename ${SVGIN} | cut -d '.' -f 1)
+ inkscape -w ${i} -h ${i} ${SVGIN} --export-filename \
+ square/png/${i}/${BASE}-${i}.png
+ done
+
+ for SVGIN in circle/svg/*; do
+ BASE=$(basename ${SVGIN} | cut -d '.' -f 1)
+ inkscape -w ${i} -h ${i} ${SVGIN} --export-filename \
+ circle/png/${i}/${BASE}-${i}.png
+ done
done
done
- done
-fi
-
-[[ ${1} == "png" ]] && exit 0
-
-if [[ ${1} == "ascii" ]]; then
- echo "Generating ASCII art"
- find . -name *ascii.txt -exec rm -v {} \;
- for SHAPE in square circle; do
- for i in ${A_SIZES[@]}; do
- mkdir -pv ${SHAPE}/ascii/${i}
-
- for PNGIN in circle/png/2048/*; do
- BASE=$(basename ${PNGIN} | cut -d '.' -f 1)
- jp2a --height=${i} ${PNGIN} > circle/ascii/${i}/${BASE}-${i}.ascii.txt
+ fi
+
+ [[ ${arg} == "png" ]] && exit 0
+
+ if [[ ${arg} == "ascii" ]]; then
+ echo "Generating ASCII art"
+ find . -name *ascii.txt -exec rm -v {} \;
+ for SHAPE in square circle; do
+ for i in ${A_SIZES[@]}; do
+ mkdir -pv ${SHAPE}/ascii/${i}
+
+ for PNGIN in circle/png/2048/*; do
+ BASE=$(basename ${PNGIN} | cut -d '.' -f 1)
+ jp2a --height=${i} ${PNGIN} > circle/ascii/${i}/${BASE}-${i}.ascii.txt
+ done
+
+ for PNGIN in square/png/2048/*; do
+ BASE=$(basename ${PNGIN} | cut -d '.' -f 1)
+ jp2a --height=${i} ${PNGIN} > square/ascii/${i}/${BASE}-${i}.ascii.txt
+ done
done
-
- for PNGIN in square/png/2048/*; do
- BASE=$(basename ${PNGIN} | cut -d '.' -f 1)
- jp2a --height=${i} ${PNGIN} > square/ascii/${i}/${BASE}-${i}.ascii.txt
+ done
+ exit 0
+ fi
+
+ if [[ ${arg} == "unicode" ]]; then
+ echo "Generating Unicode"
+ find . -name *unicode.txt -exec rm -v {} \;
+ for SHAPE in square circle; do
+ for i in ${A_SIZES[@]}; do
+ mkdir -pv ${SHAPE}/unicode/${i}
+
+ for PNGIN in circle/png/2048/*; do
+ BASE=$(basename ${PNGIN} | cut -d '-' -f -4)
+ chafa -c none -s ${i}x${i} ${PNGIN} \
+ > circle/unicode/${i}/${BASE}-${i}.unicode.txt
+ done
+
+ for PNGIN in square/png/2048/*; do
+ BASE=$(basename ${PNGIN} | cut -d '-' -f -4)
+ chafa -c none -s ${i}x${i} ${PNGIN} \
+ > square/unicode/${i}/${BASE}-${i}.unicode.txt
+ done
done
done
- done
- exit 0
-fi
-
-if [[ ${1} == "unicode" ]]; then
- echo "Generating Unicode"
- find . -name *unicode.txt -exec rm -v {} \;
+ exit 0
+ fi
+
for SHAPE in square circle; do
- for i in ${A_SIZES[@]}; do
- mkdir -pv ${SHAPE}/unicode/${i}
-
- for PNGIN in circle/png/2048/*; do
- BASE=$(basename ${PNGIN} | cut -d '-' -f -4)
- chafa -c none -s ${i}x${i} ${PNGIN} \
- > circle/unicode/${i}/${BASE}-${i}.unicode.txt
- done
-
- for PNGIN in square/png/2048/*; do
- BASE=$(basename ${PNGIN} | cut -d '-' -f -4)
- chafa -c none -s ${i}x${i} ${PNGIN} \
- > square/unicode/${i}/${BASE}-${i}.unicode.txt
- done
+ find . -name *.${arg} -exec rm -v {} \;
+
+ for i in ${SIZES[@]}; do
+ mkdir -pv ${SHAPE}/${arg}/${i}
done
+
+ while read PAT; do
+ echo "Generating ${arg}s"
+ convert -verbose ${PAT} ${PAT//png/${arg}}
+ done < <(find -name *.png)
done
- exit 0
-fi
-
-for SHAPE in square circle; do
- find . -name *.${1} -exec rm -v {} \;
-
- for i in ${SIZES[@]}; do
- mkdir -pv ${SHAPE}/${1}/${i}
- done
-
- while read PAT; do
- echo "Generating ${1}s"
- convert -verbose ${PAT} ${PAT//png/${1}}
- done < <(find -name *.png)
done