Re: [csswg-drafts] [css-color-4] How to handle infinite values in color functions? (#10507)

The CSS Working Group just [discussed](https://www.w3.org/2025/08/19-css-color-minutes.html#1f28) `[css-color-4] How to handle infinite values in color functions?` and agreed to the following:

 * `RESOLUTION: clarify that color channels have an UA define limit for values, which affect infinity clamping`

<details><summary>The full IRC log of that discussion</summary>
TabAtkins: guillaume asked what do we do if you put infinity into one of the channels ? <br>
TabAtkins: when you do conversion, it will generally produce NaN<br>
TabAtkins: is it intended ?<br>
lea: how do we handle hue being infinite ?<br>
TabAtkins: I said that infinity is fine<br>
TabAtkins: it's simply a very big value<br>
TabAtkins: we should do the same for 1million or infinity<br>
TabAtkins: romain find clamping infinity to large value give good result for conversion<br>
ChrisL: it's wrong because any define number gives a actual result, infinity does not<br>
TabAtkins: for hue infinity it's 0<br>
TabAtkins: infinity shouldnt diverge from a very big number<br>
TabAtkins: if you mix something with big number hue, you still get a valid hue<br>
florian: its not define (different on browser/hardware) but it's still a value<br>
florian: for big value, we dont define how you clamp. its UA defined<br>
florian: in this specific case, we have coordinate space, and depending on how we clamp, it can make giant changes<br>
TabAtkins: just dont use big numbers<br>
ChrisL: we had another issue closed because you said it was fine on all colorspaces, while it was okay only on srgb<br>
TabAtkins: that's the same behavior for infinity in many places in CSS like length<br>
florian: the problem pre-exist in other places like width and height<br>
<TabAtkins> `width: calc(infinity * 1px)` will give you an arbitrary very large length, might not have any meaning to the author<br>
florian: even with infinity for both width and height you not sure having a square<br>
florian: there is just no guarantee whatsoever<br>
florian: dont expect something useful necessarily<br>
TabAtkins: its also true for any arbitrary large value<br>
TabAtkins: so are color so different that we need special behavior for infinity<br>
<ChrisL> So basically `calc(Infinity)` is legal, and please don't do that<br>
TabAtkins: or we just say author should not use infinity, whatever happen is undefined<br>
TabAtkins: the remaining question is when we do color conversion, do we want to specify in the spec that infinity and large value should be clamp to a specific large value<br>
ChrisL: I prefer not have that in the color spec, but in values & units<br>
TabAtkins: The spec says that if there are implementation limit, you should clamp infinity/large to this limit<br>
TabAtkins: we should make it clear that there is an implementation limit<br>
proposal: clarify that color channels have an UA define limit for values, which affect infinity clamping<br>
TabAtkins: you should get the same behavior for infinity and arbitrary large value<br>
RESOLUTION: clarify that color channels have an UA define limit for values, which affect infinity clamping<br>
</details>

-- 
GitHub Notification of comment by svgeesus
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10507#issuecomment-3200890887 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 19 August 2025 14:00:57 UTC