Constructor. Fails for invalid color components or alpha value.
red component (integer 0 <= n <= 255)
green component (integer 0 <= n <= 255)
blue component (integer 0 <= n <= 255)
Optionalalpha: numberoptional alpha (float 0.0 <= n <= 1.0)
ReadonlyalphaGet alpha, if set. The alpha range is from 0.0 to 1.0 including.
ReadonlyblueBlue color component (0 to 255).
ReadonlycolorThe W3C extended color name matching the given RGB value. undefined
if RGB(A) cannot be represented as W3C extended color name.
ReadonlygreenGreen color component (0 to 255).
ReadonlyhasSignals, if any alpha channel has been set.
ReadonlyhexThe color as hexadecimal representation such as #010aff.
A possibly set alpha channel is ignored.
ReadonlyhexaThe color as hexadecimal representation such as #010af0a0.
An unset alpha will default to FF for full opacity.
ReadonlyopaqueSignals, if this color is opaque (no alpha or alpha = 1.0).
ReadonlyredRed color component (0 to 255).
ReadonlyrgbThe color as rgb() representation.
Any possibly set alpha channel is ignored.
ReadonlyrgbaThe color as rgba() representation.
An unset alpha will default to 1 for full opacity.
Get (preferred) color name representation. Falls back to hex or hexa
code, when it does not match a W3C extended color name.
Transforms the color to its hexadecimal representation.
Depending on if the alpha channel is set or not, uses representation as
hex or hexa.
Transforms the color to its rgb() or rgba() representation.
Depending on if the alpha channel is set or not, uses representation as
rgb or rgba.
StatictryTries parsing the given string if it represents an rgb() or
rgba() color code. If parsing is successful, returns RgbColor
representation. undefined if it does not match and/or contains invalid
parameters (such as color code components greater than 255).
value to try to parse
Represents
rgb()andrgba()color format as an immutable object.Note that browsers (just as JSDOM, CssStyle) parse colors to
rgb()andrgba()