23Mar

Unneeded Tech: Gimp palette to LessCss color variables.

Posted by Elf Sternberg as Uncategorized

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

Comment Form

Subscribe to Feed

Categories

Calendar

March 2010
M T W T F S S
« Feb   Apr »
1234567
891011121314
15161718192021
22232425262728
293031