Open mitechie opened 7 years ago
Good idea. Although, we only have SVG icons for the charms. And, the support for SVG favicons is not quiet there yet. http://caniuse.com/#feat=link-icon-svg
We would need a mechanism to convert the SVGs into PNGs on the fly.
This is bound to hurt at some point, but image magick has this baked in and can be consumed pretty easily
#!/bin/bash
# make a multi-layer favicon.ico via ImageMagick
# todo
# check if image has 1:1 aspect ratio, warn if not
# ensure image file is sane size
FILE=$1
EXT=`echo $1 | awk -F . '{print $NF}'`
BASE=`basename $FILE .$EXT`
shopt -s nocasematch
if [ -f $FILE ];
then
case "$EXT" in
jpg | gif)
echo Hint: non-png files are suboptimal
echo Creating $BASE.ico
;;
png )
echo Good, a png file, creating $BASE.ico
;;
*)
echo Must use a jpg, gif, or \(preferred\) png image
exit
;;
esac
else
echo no file $FILE
exit
fi
SIZES=""
for SIZE in 16 32 64 128
do
convert -resize x$SIZE $FILE -background transparent $BASE-${SIZE}.png
if [ $SIZES ];
then
SIZES=$SIZES,$SIZE
else
SIZES=$SIZE
fi
done
convert $BASE-{$SIZES}.png -background transparent -colors 256 $BASE.ico
rm $BASE-{$SIZES}.png
and for what its worth, this does work with svgs with some minor tweaks to the call to convert.
in viewing the https://jujucharms.com/u/spicule/gitlab/ charm in a maas tangle of tabs I realized it would be great if we could leverage the charm icon as a favicon so that there's some branding of the application on there and makes it easier to tell tabs apart.