-
Notifications
You must be signed in to change notification settings - Fork 142
Open
Labels
Description
Given that the entire set of numeric types is represented by a single CSSUnitValue class, I was surprised to see the class hierarchy of CSSColorValue. Is this complexity and rigidity needed? Note that this requires adding new classes and new methods on every CSSColorValue for every single color space supported (and it makes it harder to support custom color spaces).
Why not just
[Exposed=(Window, Worker, PaintWorklet, LayoutWorklet)]
interface CSSColorValue : CSSStyleValue {
constructor(CSSKeywordish colorspace, sequence<CSSNumberish> coords, optional alpha);
attribute CSSKeywordish colorspace;
attribute sequence<CSSNumberish> coords;
attribute CSSNumberish alpha;
CSSColorValue to(CSSKeywordish colorspace);
[Exposed=Window] static CSSColorValue parse(USVString cssText);
};Though I'm not sure how to represent the difference between e.g. color(srgb...) and rgb(...). Perhaps an additional type attribute.