This method converts color values from hue-saturation-lightness (HSL) to it's red-green-blue representation.
Check out the demo!
Special thanks to tsaniel, Alex Kloss, subzey, Jed Schmidt, and maettig for there unbelievable magic and effort!
See the 140byt.es site for a showcase of entries (built itself using 140-byte entries!), and follow @140bytes on Twitter.
To learn about byte-saving hacks for your own code, or to contribute what you've learned, head to the wiki.
140byt.es is brought to you by Jed Schmidt, with help from Alex Kloss. It was inspired by work from Thomas Fuchs and Dustin Diaz.
@maetig: @subzey approach is actually pretty simple. In the end, a is an integer in the range [ 0; 5 ], in short it only uses the 3 LSB. We are looking for a shorter way to write a=0|a%6 , (a+2)%6 and (a+4)%6 . With the knowledge that a|0 only uses the 3 LSB, we can just look for a numbers that don't touch those bits and whose modulo 6 is either 2 or 4. And that's what we have: 8%6==2 and 16%6==4
Actually, we can probably save 2 more bytes by doing:
Sorry if I missed that shot. Haven't read the whole comments thread :p