Conversation
In some rare cases Hue might get negative. The resulting Color is still correct, but we should nevertheless avoid this due to the defined Range from 0 to 360
| { | ||
| this.H += 360; | ||
| } | ||
|
|
There was a problem hiding this comment.
Wouldn't it be better to just set it to 0 in this case?
I am no color expert, but i wouldn't expect it to just add 360.
In which cases can it even go below 0?
To be honest i just copied the code without understanding much about HSL.
There was a problem hiding this comment.
Hi @batzen consider the Hue range to be a circle. If you have negative hue due to the formulas are not using absolute values, you may get negative Hue. In this case you would just go in the opposite direction on the color wheel. Adding 360° will not change the Hue but makr it positve.
There was a problem hiding this comment.
Hi @batzen ,
I modified my ColorPicker example where I use HSV-Color. The Hue is calculated the same way as in the HSL struckt.
I hope this helps for better understanding.
Have a nice Sunday
Tim
|
Sorry for responding so late. I added my comment a few weeks ago but forgot to submit it... |



In some rare cases Hue might get negative. The resulting Color is still correct, but we should nevertheless avoid this due to the defined Range from 0 to 360.
Sorry that I missed this.