I'm unclear about how HSL colours are meant to be written. W3 has them like this:
color: hsl(120, 100%, 50%);
Whereas ThreeJs asks for them like this:
h — hue value between 0.0 and 1.0
s — saturation value between 0.0 and 1.0
l — lightness value between 0.0 and 1.0
I've seen HSL colours written both ways across the web and really don't get it - which is correct, and how do you convert between the two?
Cheers.
For CSS hue value must be between 0 and 360 degrees, saturation and lightness must be between 0 and 100 percents, alpha channel must be between 0 and 1. You may use Regular Expressions to parse string CSS color and get the numeric values: