Skip to content

[css-color-4] statement about range of 'a' parameter in lab() appears incorrect #12208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dd8 opened this issue May 17, 2025 · 1 comment
Open

Comments

@dd8
Copy link

dd8 commented May 17, 2025

The spec says

The second and third arguments are the distances along the "a" and "b" axes in the Lab color space, as described in the previous section. These values are signed (allow both positive and negative values) and theoretically unbounded (but in practice do not exceed ±160).

https://drafts.csswg.org/css-color-4/#specifying-lab-lch

However, there are several files in the WPT test suite where the "a" parameter exceeds the ±160 range:

@facelessuser
Copy link

If I had to guess, that 160 statement is referring to the Rec. 2020 range, but that value is rounded. If so, then maybe stating that it is "approximately" 160 would make clear that the value is not an exact limit.

If we are using the sRGB, Display P3, or the Adobe RGB (1998) gamut as a reference, this statement is correct. While you are in gamut, you never exceed 160.

---- lab range in srgb ----
l: [0.0, 100.0]
a: [-79.271, 93.54]
b: [-112.03, 93.394]

---- lab range in display-p3 ----
l: [0.0, 100.0]
a: [-106.539, 105.77]
b: [-115.586, 122.034]

---- lab range in a98-rgb ----
l: [0.0, 100.0]
a: [-129.084, 101.297]
b: [-113.61, 103.679]

If we are using the Rec 2020 gamut, this statement is not precisely correct, but close. Though I don't know if there are even any displays that can show this entire range. If you round that value, then 160 makes sense.

---- lab range in rec2020 ----
l: [0.0, 100.0]
a: [-160.697, 125.889]
b: [-126.243, 132.125]

If we are talking about ProPhoto, then you will definitely exceed 160, but the ProPhoto gamut exceeds even the visible spectrum, the limits of the human eye. I don't think that the 160 statement is meant to cover the ProPhoto gamut. I also doubt there would ever be a monitor developed to cover this range, as it would be impractical, since no human could see all of those colors. I think this range is purposefully not considered in the 160 statement.

l: [0.0, 100.0]
a: [-186.699, 145.196]
b: [-172.28, 172.408]

So this seems to only refer to displayable SDR gamuts, not HDR gamuts, which makes sense as there is a separate HDR color spec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants