Is there some convention to divide the HSL color circle into degree ranges to define basic colors? For example, degrees 80-150 would be considered green, degrees 210-280 as blue, and so on. I’d like to automatically detect pixel’s color belonging to some “color-group” and found that HSL is very good to determine the tone. For my purpose is enough to
Tag: hsl
Javascript – Match and parse Hsl color string with Regex
I’m trying to parse a hsl color string and get an hex color string from it. I tried using regex but can’t figure it out. How my regexp should be look like to match and parse a hsl color string to hue, saturation and value fileds. The input will be one of the belows; Thanks. Answer This is probably how
Why doesn’t this Javascript RGB to HSL code work?
I found this RGB to HSL script over at http://www.mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript. I can’t find any other small decent ones. The issue is that this code doesn’t even really work. Would anybody know why? (I don’t know a bit of color math, but maybe it’s returning the complementary?) Edit: when I run rgbToHsl(126,210,22) it’s giving me [ .24, .81, .45 ], which