new Color(r, g, b [, a])
Creates a new instance of Color.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
r |
number | the R (red) value (0-255) | |
g |
number | the G (green) value (0-255) | |
b |
number | the B (blue) value (0-255) | |
a |
number |
<optional> |
the A (alpha) value (0-1.0) |
Properties:
Name | Type | Description |
---|---|---|
R |
number | the R (red) value (0-255) |
G |
number | the G (green) value (0-255) |
B |
number | the B (blue) value (0-255) |
A |
number | the A (alpha) value (0-1.0) |
Methods
-
toHexString()
-
Returns the color as a hex string e.g. #FFFFFF
Returns:
The hex color string.- Type
- string
-
toString()
-
Outputs the current color as a CSS3 RGB color string.
Returns:
The CSS3 RGB color string.- Type
- string
Example
ex. "rgb(0,0,0)" or "rgba(0,255,0,0.5)"