Defines an RGBA color (with alpha chanel).
new Color(
hexCode):Color
string
Hex code in the RGB ("#FF0000") or RGBA ("#FF0000FF") formats.
new Color(
r?,g?,b?,a?):Color
number
Red component.
number
Green component.
number
Blue component.
number
Alpha component.
get a():
number
Returns alpha component of color.
number
set a(
a):void
Sets alpha component of color. Value should be in [0, 1] range.
number
Alpha component.
void
Alpha component.
get b():
number
Returns blue component of color.
number
set b(
b):void
Sets blue component of color. Value should be in [0, 1] range.
number
Blue component.
void
Blue component.
get g():
number
Returns green component of color.
number
set g(
g):void
Sets green component of color. Value should be in [0, 1] range.
number
Green component.
void
Green component.
get r():
number
Returns red component of color.
number
set r(
r):void
Sets red component of color. Value should be in [0, 1] range.
number
Red component.
void
Red component.
clone():
Color
Creates new Color with components same as this.
copy(
other):this
Copies components from another color.
Other color.
this
getValue(
index):number
Gets individual components of this object.
number
Component index. Should be in [0, 3] range.
number
isEqual(
other,tolerance?):boolean
Returns true if other color components are equal to this point components within provided tolerance (1e-5 by default). Returns false otherwise.
Other color.
number
Components comparison tolerance;
boolean
isNull():
boolean
Returns true if color components of this object is not initialized (i.e. was created using empty constructor). Otherwise returns false.
boolean
setA(
a):this
Sets alpha component of color. Value should be in [0, 1] range.
number
Alpha component.
this
setB(
b):this
Sets blue component of color. Value should be in [0, 1] range.
number
Blue component.
this
setG(
g):this
Sets green component of color. Value should be in [0, 1] range.
number
Green component.
this
setR(
r):this
Sets red component of color. Value should be in [0, 1] range.
number
Red component.
this
setValue(
index,value):this
Sets individual components of this object.
number
Component index. Should be in [0, 3] range.
number
Component value. Should be in [0, 1] range.
this
setValues(
r?,g?,b?,a?):this
Sets r, g, b and a components of this object. Values should be in [0, 1] range.
number
Red component.
number
Green component.
number
Blue component.
number
Alpha component.
this
toJSON():
BaseRGBA
Returns JSON representation of the color.
toRGB():
number
Returns hex code of this color in RGB format.
number
toRGBA():
number
Returns hex code of this color in RGBA format.
number
toString():
string
Returns string representation of the color.
string
staticfromRGB(rgb):Color
Creates new Color object from object implementing BaseRGB interface.
Object implementing BaseRGB interface.
staticfromRGB(rgb):Color
Creates new Color object from hex code.
number
Hex code in the RGB format.
staticfromRGBA(rgba):Color
Creates new Color object from object implementing BaseRGBA interface.
Object implementing BaseRGBA interface.
staticfromRGBA(rgba):Color
Creates new Color object from hex code.
number
Hex code in the RGBA format.