Unneeded Tech: Gimp palette to LessCss color variables.

Mar 23, 2010 11:08


I recently had to convert a few GIMP palettes into color schemes for a website, and since I’m very fond of LessCSS, I decided to create LessCSS variables and use that as a plug-in to my CSS.   The trick was converting on the fly; GIMP palettes store their variables in decimal, and I like my variable names lower-case for neatness.  Nobody but me needs this, but here it is in all of its glory:

perl -ne '($a,$b,$c,$d) = m/^\s*(\d+)\s+(\d+)\s+(\d+)\s+(\w.*)$/; $d=~s/ /-/g; print sprintf("@%s: #%x%x%x;\n", lc($d), $a, $b, $c);' < palette.gpl > colors.less
This entry was automatically cross-posted from Elf's technical journal, ElfSternberg.com

uncategorized

Previous post Next post
Up