- From: Chris Lilley via GitHub <sysbot+gh@w3.org>
- Date: Tue, 11 May 2021 15:55:48 +0000
- To: public-houdini-archive@w3.org
svgeesus has just created a new issue for https://github.com/w3c/css-houdini-drafts: == [css-typed-om] the `CSSColor` constructor is wrong == In [4.6 CSSColorValue objects](https://drafts.css-houdini.org/css-typed-om/#colorvalue-objects), the `CSSColor` constructor is given as ``` [Exposed=(Window, Worker, PaintWorklet, LayoutWorklet)] interface CSSColor : CSSColorValue { constructor (sequence<(DOMString or CSSNumberish)> variant ); /* CSSColor(["foo", 0, 1, .5], ["bar", "yellow"], 1, fallbackColor) */ /* or just make the alpha and fallback successive optional args? */ }; ``` This has several problems. Firstly, the `colorspace` slot is not named which makes it hard to refer to it; in CSS Color 4 the colorspace parameter to `color()` is mandatory. Secondly, the `alpha` is also not named, but needs to be so that the various `toFoo` methods can require that it be filled in. And yes it should be an optional argument. Thirdly, the non-normative comment uses the old syntax with multiple fallbacks. It also uses a colorspace "foo" which is not a dashed ident, nor is it a prefefined colorspace, so Typed OM would currently return a `SyntaxError`. I suggest replacing the comment with /* CSSColor(["display-p3", 0, 1, .5] */ So the constructor should take: 1. The `colorspace` 2. The parameters (if the intent really is to restrict to predefined RGB spaces, these could be called `r` `g` and `b`; but that also cuts out `xyz` and `lab` from being represented. Otherwise, make them a sequence of parameters 3. Optionally, the `alpha` Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/1032 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 11 May 2021 15:55:50 UTC