Re: [csswg-drafts] [css-color-4] lab and oklab inconsistencies (#8138)

Indeed, CSS is making a concession to authors and tools by supporting `<number>` values in functional color notations, whose meanings and ranges are defined outside W3C, at all. Such convenience syntax has been established early on with `rgb()` also accepting `<number[0,255]>`. 

We could argue – and I believe it already has been argued – whether it makes sense to accept arbitrary mixes of percentages and numbers. That is, like `rgb()`, the syntax for Lab spaces might be better defined as:

~~~~
lab() = lab(<lab>)
oklab() = oklab(<lab>)

<lab> = [<percentage> | none]{3}
      | [<number> | none]{3}
      [ / [<alpha-value> | none] ]?
~~~~

or even:

~~~~
<lab> = [ [<percentage> | none]{3} [ / [<percentage> | none] ]? ]
      | [ [<number> | none]{3} [ / [<number> | none] ]? ]
~~~~

instead of:

~~~~
lab() = lab
      (
      [<percentage> | <number> | none]
      [<percentage> | <number> | none]
      [<percentage> | <number> | none]
      [ / [<alpha-value> | none] ]?
      )
~~~~

This argument applies likewise to hue angles:

~~~~
<lch> = [<percentage> | none]{2} [<angle> | none] [ / [<percentage> | none] ]?
      | [<number> | none]{3} [ / [<number> | none] ]?
~~~~

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


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

Received on Wednesday, 30 November 2022 07:50:02 UTC