You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a test in svgtypes for when HSL values are out of range from parse time.
It expects hsl(800, 150%, -50%) to result in rgba(0, 0, 0, 255) as the lightness is clamped to 0, and so the value is a black color.
While the CSS Color Module 4 spec says that, when parsing HSL, saturation is clamped, it does not say it about lightness.
Section 4.2 does say to clamp alpha.
Section 5.1 does say to clamp r, g, and b when parsing rgb().
Section 7 says to clamp saturation for HSL.
Section 9.3 says to clamp L for Lab and Lch.
Section 9.4 says to clamp L for OkLab and OkLch.
Section 13.2 says that when gamut mapping to ran rgb destination, the out of range lightness values should be handled by resulting in either black or white colors.
Even if we clamp at parse time, we'd have to think also about what to do when the lightness has been modified (like via map_lightness) and is now out of range due to calculations.
The text was updated successfully, but these errors were encountered:
The reason Oklab/Lab are clamped appears to be that they're not great at predicting colors outside of SDR. The reason HSL became unbounded is because it roundtrips fine to sRGB.
I believe Lab and Oklab in theory also roundtrip fine, they're just matrix multiplies and cubes, though they get into floating point issues sooner. Maybe this is a question for the spec authors.
There is a test in svgtypes for when HSL values are out of range from parse time.
It expects
hsl(800, 150%, -50%)
to result inrgba(0, 0, 0, 255)
as the lightness is clamped to 0, and so the value is a black color.While the CSS Color Module 4 spec says that, when parsing HSL, saturation is clamped, it does not say it about lightness.
rgb()
.Even if we clamp at parse time, we'd have to think also about what to do when the lightness has been modified (like via
map_lightness
) and is now out of range due to calculations.The text was updated successfully, but these errors were encountered: