Hacker News new | ask | show | jobs
by jacobolus 3385 days ago
“HSL” is a trivial transformation of RGB. It’s what you get when you prop an RGB cube up on one corner, squish 6 of the other corners into the same plane, and then inflate it until it fills a cylinder shape. (Note that none of these steps make any reference to human perception.) Here’s my 2010 diagram showing that visually https://en.wikipedia.org/wiki/File:Hsl-and-hsv.svg

> Also, how exactly is lab color useful in web programming? How do you support it in CSS or HTML?

Implementing CIELAB in Javascript is straightforward. https://github.com/jrus/chromatist/blob/master/src/cielab.co...

You could alternately use a model like CIECAM02, but that gets a whole lot more complicated. https://github.com/jrus/chromatist/blob/master/src/ciecam.co...

2 comments

I just wanted to say that the diagram of the transformation from RGB to the different color models is absolutely beautiful as well as informative. When I have a free day or two I am going to have to put together an animation for it where you can track a given color through the process. My favorite class in university was about color models, all the way from CIE 1931 to the various transformations on it to match human perception and driven by anatomical insights about the human eye. It's fascinating!
Just because something can be translated into something else doesn't mean that it is "based" on that thing.

Would you say celsius is "based" on fahrenheit? Or the other way around?

Is yiddish based on english?

Both RGB and HSL are based on the physics of color and perception. Just because it is trivial to transform one to the other doesn't mean anything.