|
The only real changes have been to the hue selection bit. hslToRgb: function(a) { var d = 3, hsl = [ [ [ 255, 0, 0 ], 1, 1 ], [ [255, 255, 0 ], 0, -1 ], [ [ 0, 255, 0 ], 2, 1 ], [ [0, 255, 255 ], 1, -1 ], [ [ 0, 0, 255 ], 0, 1 ], [ [ 255, 0, 255 ], 2, -1 ] ][Math.floor(a[0] / 40)]; hsl[0][hsl[1]] += Math.floor(6.375 * (a[0] % 40)) * hsl[2]; hsl = hsl[0]; while(d --) { hsl[d] -= ((hsl[d] - 127) * (240 - a[1]) / 240); hsl[d] -= (a[2] > 120 ? 255 - hsl[d] : hsl[d]) * ((120 - a[2]) / 120); } return [ Math.round(hsl[0]), Math.round(hsl[1]), Math.round(hsl[2]) ]; }
Last Edit: Aug 21, 2010 4:59:46 GMT by Aaron
|
|
|
|
|
I know that this is semi-off-topic, but where is HSL ever used? I've used RGB and Hex many time, but never once had to use HSL... More for graphics and 3D rendering than for web usage.
|
|
|
|
|
Ahh. Most languages I've used just use RGB values, and Hex is just another way of numbering the 0 - 255 digits... HSL just seems like such a foreign thing to me. EDIT: Just realised that everytime I used a color-related tool in GIMP I was using HSL notation for things... I guess it wasn't that foreign after all.
Last Edit: Jan 8, 2013 16:53:19 GMT by ~Memzak~
|
|
|
|
|
Ahh. Most languages I've used just use RGB values, and Hex is just another way of numbering the 0 - 255 digits... HSL just seems like such a foreign thing to me. EDIT: Just realised that everytime I used a color-related tool in GIMP I was using HSL notation for things... I guess it wasn't that foreign after all. en.wikipedia.org/wiki/HSL_and_HSVThat'll explain it better. You should get it if you just look at the main picture on the right.
|
|
|
|
|
Right... the internet can have the information I need sometimes... Gave it a brief read-through and looked at the diagram. (doing the latter first, obviously xD) It makes a lot more sense now. Thanks.
|
|
|
|