-
Notifications
You must be signed in to change notification settings - Fork 141
Closed
Labels
Description
In 4.6 CSSColorValue 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:
- The
colorspace
- The parameters (if the intent really is to restrict to predefined RGB spaces, these could be called
r
g
andb
; but that also cuts outxyz
andlab
from being represented. Otherwise, make them a sequence of parameters - Optionally, the
alpha