createsvg() { local d local svg for d in assets/*.ai; do svg=$(echo "$d" | sed 's/.ai/.svg/') echo "creating $svg ..." inkscape -f "$d" -l "$svg" done mkdir -p svg mv assets/*.svg svg/ } viewport() { local f for f in svg/*.svg; do content=$( cat "$f" | sed 's///' | sed 's/viewBox="0 0 47.5 47.5"//' | sed 's/height="47.5"/viewBox="0 0 47.5 47.5"/' | sed 's/width="47.5"/style="enable-background:new 0 0 47.5 47.5;"/' | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n//g' | sed -e 's/ */ /g' | sed -e 's/ \/>/\/>/g' ) echo "$f" echo "$content" >"$f" done } skintone() { local f local key local tonecode local tone local hilitetone local content local filename local tonecodes=(default 1f3fb 1f3fc 1f3fd 1f3fe 1f3ff) local tones=(ffcc4d fadcbc e0bb95 bf8468 9b643d 594539) local hilitetones=(ffdd5e f1cca6 cf9579 ac754e 6a564a) local base=(1f466 1f467 1f468 1f469 1f474 1f475 1f476 1f471 1f46e 1f472 1f473 1f477 1f478 1f482 1f385 1f47c 1f486 1f487 1f470 1f64d 1f64e 1f645 1f646 1f481 1f64b 1f647 1f600 1f601 1f602 1f603 1f604 1f605 1f606 1f609 1f60a 1f60b 1f60e 1f60d 1f618 1f617 1f619 1f61a 263a 1f642 1f917 1f607 1f914 1f610 1f611 1f636 1f644 1f60f 1f623 1f625 1f62e 1f910 1f62f 1f62a 1f62b 1f634 1f60c 1f913 1f61b 1f61c 1f61d 2639 1f641 1f612 1f613 1f614 1f615 1f616 1f643 1f637 1f912 1f915 1f911 1f632 1f61e 1f61f 1f624 1f622 1f62d 1f626 1f627 1f628 1f629 1f62c 1f630 1f631 1f633 1f635 1f621 1f620 1f47f 1f608 1f64c 1f64f 1f6b6 1f3c3 1f483 1f4aa 1f448 1f449 261d 1f446 1f595 1f447 270c 1f596 1f918 1f590 270a 270b 1f44a 1f44c 1f44d 1f44e 1f44b 1f44f 1f450 270d 1f485 1f442 1f443 1f6a3 1f6c0 1f3c2 1f3c4 1f3c7 1f3ca 1f6b4 1f6b5); echo "Diversity Preview" >"svg-diversity/preview.html" for f in "${base[@]}"; do if [ ! -f "svg/$f.svg" ]; then continue fi for key in "${!tonecodes[@]}"; do tonecode="${tonecodes[$key]}" tone="${tones[$key]}" hilitetone="${hilitetones[$key]}" # Convert base skin tones content=$( cat "svg/$f.svg" | sed -E "s/#(d79e84|d99e82|c28b6e)/#$tone/g" ) # Convert base skintone hilites content=$( echo "$content" | sed -E "s/#(c1694f|bf6952)/#$hilitetone/g" ) # Convert "yellow" skin tone content=$( echo "$content" | sed "s/#ffcc4d/#$tone/g" ) if [ "1f46e" != $f ]; then # Policeman uses this colour for the badge on his hat content=$( echo "$content" | sed "s/#fdcb58/#$tone/g" ) fi # No need to convert purple/red to yellow if [ "ffcc4d" != $tone ]; then # Convert "purple" skin tone content=$( echo "$content" | sed "s/#aa8ed6/#$tone/g" ) # Convert "red" skin tone content=$( echo "$content" | sed "s/#da2f47/#$tone/g" ) fi # Special cases for the darkest skin tone if [ "594539" == $tone ]; then # Make eyes darker content=$( echo "$content" | sed -E "s/#(662113|664500)/#101010/g" ) # Make hair darker content=$( echo "$content" | sed -E "s/#(642116|414042|662214)/#101010/g" ) fi # Yellow doesn't need a modifier filename if [ "default" == $tonecode ]; then filename="$f.svg" else filename="$f-$tonecode.svg" fi echo "" >>"svg-diversity/preview.html" echo "svg-diversity/$filename" echo "$content" >"svg-diversity/$filename" done done echo "" >>"svg-diversity/preview.html" } #createsvg #viewport skintone