Skip to content

Instantly share code, notes, and snippets.

Created March 20, 2014 17:02
Show Gist options
  • Save anonymous/9668694 to your computer and use it in GitHub Desktop.
Save anonymous/9668694 to your computer and use it in GitHub Desktop.
Automatically convert glyphicons to different colors
#!/bin/bash
while read NAME HEX; do
for i in `find -name "*-white.svg"`; do
FILENAME=`echo $i | sed -e "s/white/$NAME/g"`
sed -e "s/#FFFFFF/$HEX/g" $i >$FILENAME
PNG=`echo $FILENAME | sed -e "s/svg/png/g"`
convert $FILENAME -transparent white $PNG
done
for i in "" "filetypes" "halflings" "social"; do
WHERE="_$i"
if [[ "$i" = "" ]]; then
WHERE=""
fi
FILENAME="./glyphicons$WHERE/web/html_css/css/$NAME.css"
echo ".social.$NAME:before {
color: $HEX;
}
.social-icon.$NAME {
background-image: url(../images/glyphicons_social-$NAME.svg);
}
.social-icon.$NAME _:-o-prefocus,
.social-icon.$NAME {
background-image: url(../images/glyphicons_social-$NAME.png);
}
.no-inlinesvg .social-icon.$NAME {
background-image: url(../images/glyphicons_social-$NAME.png);
}" > $FILENAME
done
done < colors
green #006600
dark-blue #375EAB
pale-blue #E0EBF5
pale-yellow #FFFFD8
maroon #933
orange #FF9632
cd glyphicons_pro
./colorize.sh
find -name "*.css" | fgrep -v -e MACOSX -e style.css | xargs cat >all.css
cp all.css ~/my/project/css
for i in `find -name "*.svg" -or -name "*.png" | grep html_css`; do
cp $i ~/my/project/images/
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment