Color
This class represents a CSS color value. String parameters to the constructor argument can take one of the following forms:
HTML color name, e.g.
`Red`
,`DarkSalmon`
(case-insensitive), though in this case the use of the pre-defined constants is recommended.`#rgb`
or`#rrggbb`
`rgb(0..255, 0..255, 0..255)`
,`rgb(0..100%, 0..100%, 0..100%)`
,`rgb(0..100%, 0..100%, 0..100%, 0..1)`
,`rgba(0..255, 0..255, 0..255, 0..1)`
`hsl(0..360, 0-100%, 0..100%)`
or`hsla(0..360, 0-100%, 0..100%, 0..1)`
Technically, the Hue parameter to `hsl`
or `hsla`
can exceed `360`
, because it represents a degree (angle) on the color wheel. But as per the algorithm proposed by the W3C, the value will ultimately be capped to `360`
through a series of modulus operations; see section 4.2.4. HSL color values of the above specification.