Re: [csswg-drafts] [css-color] Support all existing (non-legacy?) formats in color()? (#6741)

A first proposal that maintains the current `[<number-percentage> | none]+` syntax:

* __Polar coordinates__ (e.g. the hue in `hsl`, `hwb`, `lch`, and `oklch`) accept `<number>` in the `[0, 360]` range, with `<percentage>` mapping to that range.
* __Theoretically-unbounded coordinates with meaningful ranges__, (e.g. the lightness in `lab`, `oklab`, `lch`, and `oklch`), accept `<number>` in their respective useful range (`[0, 100]` for `lab` / `lch`, `[0, 1]` for `oklab` / `oklch`).  
* __Theoretically-unbounded coordinates without a meaningful range__, (e.g. a, b, and chroma in the CIE/OK spaces), can accept `<number>` liberally. We don't, however, have the reference against which to map `<percentage>`, so the value falls back to 0, as if the component was omitted or specified with `none`. Other options include inventing a reference range (and there are quite a few ranges to invent), or treating the color as invalid.

On the invention front, Photoshop clamps a/b in CIELAB to `[-128, 127]`:

<img width="279" alt="Photoshop dialog reads: An integer between -128 and 127 is required. Closest value inserted." src="https://user-images.githubusercontent.com/205375/138836244-f407fb84-82fd-4b1d-8250-0c2c0606f613.png">

I'll add one more reason for allowing all color formats to be expressed as `color()`: enabling the interop-friendly `<number>` for L in CIE/OK spaces which, depending on the conclusion of [this separate issue](https://github.com/w3c/csswg-drafts/issues/6761), may or may not be allowed in the dedicated color functions.

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


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

Received on Tuesday, 26 October 2021 08:22:06 UTC