Closed shuai-z closed 1 year ago
Yes, this is as expected. The hue is powerless, which is represented in CSS with the keyword none
and in code with the value NaN
.
For example, in hsl(), the hue component is powerless when the saturation component is 0%; a 0% saturation indicates a grayscale color, which has no hue at all, so 0deg and 180deg, or any other angle, will give the exact same result.
If such a color value is converted to another color space, the value 0
will be used for the missing value. However, if two colors are interpolated and one has a missing value while the other has a valid value for an analogous component, then the missing value is taken from that second color.
The souce code in Converting sRGB Colors to HSL (or file css-color-4/rgbToHsl.js) produced
hue
asNaN
whenmax
equals tomin
. it should be 0 in this case.