Color
The Color class represents an RGB color value. Color instances are immutable. The constructors are accessible from scripts.
Fields
Field
Type
Description
r
number
Read only. The red component, as a value between 0.0 and 1.0.
g
number
Read only. The green component, as a value between 0.0 and 1.0.
b
number
Read only. The blue component, as a value between 0.0 and 1.0.
a
number
Read only. The alpha component, as a value between 0.0 and 1.0.
Methods
init( r, g, b )
Constructs a new Color instance with the given red, green and blue values (in the range 0.0 to 1.0) and an alpha of 1.0.
init( r, g, b, a )
Constructs a new Color instance with the given red, green, blue and alpha values (in the range 0.0 to 1.0).
init( name )
Constructs a new Color instance derived from standard HTML color hex value or color name; e.g., “#FF0000”, “white”, “black”, “orange”, etc. See Online Resources for a link to a complete list.
equals( object )
Returns True if object represents the same color as self within a set tolerance.
Pre-defined colors
These are class variables of Color. Note that some are not a match for the HTML color name equivalent; e.g., ORANGE
is the not the same color as HTML “orange”.
Name
r
g
b
BLACK
0.00
0.00
0.00
WHITE
1.00
1.00
1.00
RED
1.00
0.00
0.00
ORANGE
1.00
0.50
0.00
YELLOW
1.00
1.00
0.00
GREEN
0.00
1.00
0.00
BLUE
0.00
0.00
1.00
VIOLET
1.00
0.00
0.50
CYAN
0.00
1.00
1.00
MAGENTA
1.00
0.00
1.00
GRAY
0.50
0.50
0.50
LIGHT_GRAY
0.75
0.75
0.75
DARK_GRAY
0.25
0.25
0.25
Last updated