This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ideas:color-object [2014/07/07 17:48] – Add defaults to the dictionaries. Add dictionary overloads to the constructor and "fromFoo" functions. tabatkins | ideas:color-object [2021/10/01 15:36] (current) – fantasai | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | < | ||
+ | This has been superseded by work on a common color API for the Web Platform and by work on Typed OM for manipulating CSS syntax specifically. | ||
+ | </ | ||
+ | |||
+ | <code idl> | ||
[Constructor(double r, double g, double b, optional double a=1), | [Constructor(double r, double g, double b, optional double a=1), | ||
| | ||
Line 7: | Line 12: | ||
attribute double a; | attribute double a; | ||
| | ||
- | | + | |
static RGBAColor fromHSLA(double h, double s, double l, optional double a=1); | static RGBAColor fromHSLA(double h, double s, double l, optional double a=1); | ||
static RGBAColor fromHSLA(optional HSLAColorInit color); | static RGBAColor fromHSLA(optional HSLAColorInit color); | ||
| | ||
- | | + | |
static RGBAColor fromHex(octet r, octet g, octet b, optional octet a=255); | static RGBAColor fromHex(octet r, octet g, octet b, optional octet a=255); | ||
static RGBAColor fromHex(optional HexColorInit color); | static RGBAColor fromHex(optional HexColorInit color); | ||
| | ||
- | | + | DOMString? asName(); |
+ | |||
+ | DOMString toString(optional DOMString type=" | ||
static readonly attribute Map serializationTypes; | static readonly attribute Map serializationTypes; | ||
}; | }; | ||
+ | </ | ||
- | The stringifier | + | The '' |
- | Authors can define their own color formats by adding a fromFoo() to RGBAColor, a toFoo() to RGBAColor.prototype, | + | Authors can define their own color formats by adding a '' |
+ | <code idl> | ||
dictionary RGBAColorInit { | dictionary RGBAColorInit { | ||
double r = 0; | double r = 0; | ||
Line 29: | Line 38: | ||
double a = 1; | double a = 1; | ||
}; | }; | ||
+ | | ||
dictionary HSLAColorInit { | dictionary HSLAColorInit { | ||
double h = 0; | double h = 0; | ||
Line 45: | Line 54: | ||
| | ||
partial interface CSS { | partial interface CSS { | ||
- | | + | |
}; | }; | ||
+ | </ | ||
+ | |||
+ | '' | ||
- | If parseColor | + | The optional second argument |
- | such as '' | + | |
- | but no el argument | + | |
- | throw a XXX error. | + |