Re: [csswg-drafts] [css-conditional-5][css-color] Define `style()` color comparison in more precise terms (#13157)

Strawperson for color comparisons:

# Comparing colors

Comparison of two [<color>](https://www.w3.org/TR/css-color-4/#typedef-color) values for equality takes place by executing the following steps:

 - checking the two colors for [analogous components](https://www.w3.org/TR/css-color-4/#analogous-components) which will be carried forward
 - converting them to a given color space which will be referred to as the comparison color space below. If one or both colors are already in the comparison color space, this conversion changes any [powerless](https://www.w3.org/TR/css-color-4/#powerless-color-component) components to [missing](https://www.w3.org/TR/css-color-4/#missing-color-component) values. If no comparison color space is specified, `oklab` is used
 - (if required) re-inserting [carried forward](https://www.w3.org/TR/css-color-4/#carried-forward) values in the converted colors
 - the two colors are compared, component by component, for equality. To accommodate floating point errors due to color space conversion, implementations will return true if the difference between two components is less than some small value **ε**

For interoperability, defining **ε** should be done in the spec, at least for `oklab`.

It could well be that we don't need any other comparison color space than `oklab` but I prefer not to assume that at this stage.

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


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

Received on Monday, 23 March 2026 21:11:42 UTC