3 ms·
Note that hsl is a breeze to set, but a pain in the ass to get. Browser engines convert it to rgb(a) and if you want to check if anything has, say, saturation 1
by duopixel 16y ago
Note that hsl is a breeze to set, but a pain in the ass to get. Browser engines convert it to rgb(a) and if you want to check if anything has, say, saturation 100% you must first convert back to hsl from rgb.
To make matters worse, the hsl color spectrum covers colors that RGB can't represent, so you if you're checking for a particular color the conversion algorithm will throw you back something with a few digits off.
Otherwise yes, hsl rocks!
- jacobolus 16y ago> hsl color spectrum covers colors that RGB can't represent This is simply false. HSL is a simple deformation of the RGB cube into a cylinder, as you can see in this nice diagram I drew up about a year ago: http://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/Hsl-and-hsv.svg/1000px-Hsl-and-hsv.svg.png http://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/Hsl... > conversion algorithm will throw you back something with a few digits off These are rounding errors, and shouldn’t be especially noticeable. So what?
- duopixel 16y ago> This is simply false. You are right, what I meant is that you can set h = 200 s = 100% l = 0% and you will get back R = 0, G = 0, B = 0. > These are rounding errors, and shouldn’t be especially noticeable. So what? Not to the eye, but for computers it is. Say you want to check if an element has a background color of hsl(100, 30%, 30%) because you set this color before. Well, you can't. I ran into this problem while building http://memela.com http://memela.com and I had to switch to rgb because of this.