Class: RgbaColor
Represents a color with red, green, blue, and alpha components.
Extends
Implements
Cloneable<RgbaColor>
Constructors
Constructor
new RgbaColor(
colorString):RgbaColor
Creates a new RgbaColor instance from a string representation (hex, rgb, rgba or hsl).
Parameters
colorString
string
The string representation of the color.
Returns
RgbaColor
Throws
If the input string is not a valid color representation.
Overrides
Constructor
new RgbaColor(
r?,g?,b?,a?):RgbaColor
Creates a new RgbaColor instance.
Parameters
r?
number
The red component of the color (0 to 255).
g?
number
The green component of the color (0 to 255).
b?
number
The blue component of the color (0 to 255).
a?
number
The alpha (transparency) component of the color (0 to 1).
Returns
RgbaColor
Overrides
Properties
a
a:
number
The alpha component of the color (0 to 1).
b
b:
number
The blue component of the color (0 to 255).
Inherited from
g
g:
number
The green component of the color (0 to 255).
Inherited from
r
r:
number
The red component of the color (0 to 255).
Inherited from
Accessors
blue
Get Signature
get blue():
number
The intensity of blue in the described color as a value 0-255.
Returns
number
Inherited from
green
Get Signature
get green():
number
The intensity of green in the described color as a value 0-255.
Returns
number
Inherited from
red
Get Signature
get red():
number
The intensity of red in the described color as a value 0-255.
Returns
number
Inherited from
Methods
clone()
clone():
RgbaColor
Creates a deep copy of the object.
Returns
RgbaColor
A new instance that is a deep copy of the original object.
Implementation of
Overrides
setRGB()
setRGB(
red,green,blue):void
Set a new color with all components at once
Parameters
red
number
green
number
blue
number
Returns
void
Inherited from
toHexString()
toHexString():
string
Converts the color to a hexadecimal string
Returns
string
A string representation of the color in hexadecimal
Example
#330000
Inherited from
toRgbaString()
toRgbaString():
string
Converts the color to a CSS-formatted RGBA string.
Returns
string
A string representation of the color in RGBA format.
Overrides
toRgbString()
toRgbString():
string
Converts the color to a CSS-formatted RGB string.
Returns
string
A string representation of the color in RGB format.