- From: Chris Lilley via GitHub <sysbot+gh@w3.org>
- Date: Sat, 30 Jul 2022 13:04:11 +0000
- To: public-css-archive@w3.org
I started working on examples and (once you consider nonsense examples, because `none` can occur anywhere) find I have an order of operations problem. Here is a dumb example: ```css --start: color(prophoto-rgb 0.3 none 0.7 /0.5); --end: lab(100% 0 0 / none); .foo { background: linear-gradient(in oklab to right, var(--start) var(--end)); } ``` Selected quotes from the spec: > For handling of [missing component](https://drafts.csswg.org/css-color-4/#missing-color-component) in color interpolation, see [§ 12.2 Interpolating with Missing Components](https://drafts.csswg.org/css-color-4/#interpolation-missing) and >For all other purposes, a [missing component](https://drafts.csswg.org/css-color-4/#missing-color-component) behaves as a zero value, in the appropriate unit for that component: 0, 0%, or 0deg. This includes rendering the color directly, converting it to another color space, performing computations on the color component values, etc. (both from [4.4 “Missing” Color Components and the `none` Keyword](https://drafts.csswg.org/css-color-4/#missing) > Interpolation between [<color>](https://drafts.csswg.org/css-color-4/#typedef-color) values occurs by first converting them to a given color space which will be referred to as the 'interpolation space' below, and then linearly interpolating each component of the computed value of the color separately. from [12. Color Interpolation](https://drafts.csswg.org/css-color-4/#interpolation) and lastly > If a color with a [missing component](https://drafts.csswg.org/css-color-4/#missing-color-component) is interpolated with another color which is not missing that component, the missing component is treated as having the other color’s component value. from [12.2. Interpolating with Missing Components](https://drafts.csswg.org/css-color-4/#interpolation-missing) So on the one hand, `--end` needs to get the alpha value from `--start`, 0.5, which is easy as they both have an alpha component in their source forms; but also, `--start` needs to get the green value from `--end` which is problematic because Lab doesn't have a green component. And this filling in of missing components must necessarily happen **before** converting them to the interpolation color space, because color space conversion changes missing values to 0. What I think is reasonable, then is that there is no green component to copy from; and thus `--start` is unchanged; and when converted to OKLab the missing component will become zero. ```css --start: color(prophoto-rgb 0.3 0 0.7 /0.5); --end: lab(100% 0 0 / 0.5); ``` which is ```css oklab(38.63% 0.076 -0.27 / 0.5) oklab(100% 0 0 / 0.5) ``` and interpolation proceeds as normal (both colors are premultiplied, components are interpolated, results are un-premultiplied). -- GitHub Notification of comment by svgeesus Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7536#issuecomment-1200153945 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Saturday, 30 July 2022 13:04:12 UTC