mdn / content

The content behind MDN Web Docs
https://developer.mozilla.org
Other
9.13k stars 22.45k forks source link

[css-color] Percent reference ranges do not imply maximum allowed values in color functions #32408

Closed romainmenke closed 6 months ago

romainmenke commented 6 months ago

MDN URL

https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/lab

What specific section or headline is this issue about?

Values: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/lab#values

What information was incorrect, unhelpful, or incomplete?

A <number> between -125 and 125, a <percentage> between -100% and 100%, or the keyword none, which specifies the distance along the a axis in the CIELAB colorspace, that is how green/red the color is.

What did you expect to see?

It seems there has been some confusion between the percent references ranges for color functions and the max/min allowed values.

I think this is likely incorrect for all color functions but definitely for lab, oklab, ...


There are multiple important concepts.

1: Values can be expressed as both numbers and percentages. Because of this it needs to be specified wat 0% and 100% map to.

2: Values can be bound or unbound and when bound have specified min/max values.

3: Values can be theoretically unbound but still have maximum values which are practically useful.

It seems that the current documentation mixes these aspects and states the corresponding values for 0% and 100% as bounds. (Or maybe an earlier specification stated these as max/min values?)


a and b for lab for example are unbound.

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).

Do you have any supporting links, references, or citations?

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

Do you have anything more you want to share?

No response

romainmenke commented 6 months ago

@chrisdavidmills @estelle in context of https://github.com/mdn/content/pull/32004#discussion_r1500377820

estelle commented 6 months ago

Thank you. I have been trying to wrap my head around the # v. %. I definitely misunderstood it.