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:43] – Properly use wiki markup 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> | ||
+ | | ||
+ | | ||
interface RGBAColor { | interface RGBAColor { | ||
attribute double r; | attribute double r; | ||
Line 6: | Line 12: | ||
attribute double a; | attribute double a; | ||
| | ||
- | | + | |
- | HexColor asHex(); | + | |
- | | + | |
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); | ||
+ | | ||
+ | HexColorInit asHex(); | ||
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); | ||
+ | | ||
+ | DOMString? asName(); | ||
| | ||
- | | + | DOMString |
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> |
- | double | + | |
- | double | + | double |
- | double | + | double |
- | double a; | + | double |
+ | double a = 1; | ||
}; | }; | ||
| | ||
- | dictionary | + | dictionary |
- | octet r; | + | double h = 0; |
- | octet g; | + | double s = 1; |
- | octet b; | + | double l = .5; |
- | octet a; | + | double a = 1; |
+ | }; | ||
+ | |||
+ | dictionary HexColorInit | ||
+ | octet r = 0; | ||
+ | octet g = 0; | ||
+ | octet b = 0; | ||
+ | octet a = 255; | ||
}; | }; | ||
| | ||
partial interface CSS { | partial interface CSS { | ||
- | | + | |
}; | }; | ||
+ | </ | ||
+ | |||
+ | '' | ||
- | If parseColor | + | The optional second argument |
- | such as '' | + | |
- | but no el argument | + | |
- | throw a XXX error. | + |