- From: Romain Menke via GitHub <sysbot+gh@w3.org>
- Date: Sat, 13 Apr 2024 08:35:36 +0000
- To: public-css-archive@w3.org
This issue is not about what happens to `none` during color space conversion. That part is well defined and I think everyone is in agreement about how it is defined. It is also not about the utility of `none` in general for colors. This is equally well defined and agreed upon :) I took a weird turn somewhere and started imagining preserving `calc(none + 20)` resulting in `hsl(calc(none + 20) 50% 50%)` as the final value. ----------- > If all components in the source color (except `alpha`) are `none`, then they remain `none`. (`oklch(none none none / 0%)` is like `transparent` on steroids) I like this, but it is separate from this issue. I will file a new issue specifically for this. ----------- https://drafts.csswg.org/css-color-5/#relative-syntax > The channel keywords return a `<number>`; if they were originally specified as a `<percentage>` or an `<angle>`, that `<percentage>` is resolved to a `<number>` and the `<angle>` is resolved to a `<number>` of degrees (which is the canonical unit) in the range `[0, 360]`. But `none` is not a number. https://drafts.csswg.org/css-values-4/#numbers So even if color space conversions preserve `none`, this section still requires a conversion to `<number>`, at which point `none` becomes `0`. This applies to all channel keywords, regardless of the presence of math expressions. ----------- https://drafts.csswg.org/css-color-5/#relative-syntax > However, if calculations are done on missing values, `none` is treated as 0. This is specifically for usage in math expressions. ---------- These two phrases make it so that `none` always becomes `0` even if we agree that it should remain `none` as a result of color space conversion when possible therein :) ---------- I think that the first (typing as `<number>`) is simply an oversight and needs an extra clause to clarify that `none` at this stage isn't converted to a number. The second however is less simple. It requires defining what `none` means in math expressions. For example it was recently added that `none` in `clamp` has a very specific meaning. This is very useful. I can also imagine stuff like `round(1.2, none)` having specific behavior. This is work that should be done for the css-values spec. Might be interesting to have specific handling of `none` at the various positions in math functions. Where the outcome is either specific behavior (`clamp`), `0`, or invalid to preserve for future use. -- GitHub Notification of comment by romainmenke Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10151#issuecomment-2053575203 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Saturday, 13 April 2024 08:35:36 UTC