Skip to content

Color

The Color class represents a struct that is used to describe the values of the RGBA color components.

构造方法

Color.new ( r : number? , g : number? , b : number? , a : number? )
Create a color data with specified RGB and Alpha components.

成员变量

Color.r : number
The red component of the color (range from 0 to 1).
Color.b : number
The blue component of the color (range from 0 to 1)
Color.g : number
The green component of the color (range from 0 to 1).
Color.a : number
The alpha component of a color (0 is transparent, 1 is opaque).
Color.inverse : Color
(Read-only) Returns the complementary color of the current color.

静态变量

Color.white : Color
(Read-only) White Color object.
Color.magenta : Color
(Read-only) Magenta Color object
Color.black : Color
(Read-only) Black Color object
Color.cyan : Color
(Read Only) Cyan Color object.
Color.red : Color
(Read-only) Red Color object.
Color.grey : Color
(Read Only) Gray Color object.
Color.green : Color
(Read-only) Green Color object.
Color.blue : Color
(Read-only) Blue Color object
Color.yellow : Color
(Read Only) Yellow Color object.
Color.clear : Color
(Read Only) Transparent color Color object

成员方法

Color.Get ( index : number ) : number
Get the color component based on the index.
Color.Inverse ( ) : void
Changes the current color to its complementary color.
Color.toString ( ) : string
Converts the current color object to a string.
Color.SetFromHSV ( h : number , s : number , v : number ) : void
Set the color based on the hue, saturation, and value.
Color.CopyFrom ( from : Color ) : void
Copy the color from the specified color to the current color object.
Color.Set ( index : number , value : number ) : void
Get the color component based on the given index.
Color.Add ( rhs : Color ) : Color
Adds the specified color to the current color and returns a new color.
Color.Sub ( rhs : Color ) : Color
Subtracts the specified color from the current color and returns a new color.
Color.Mul ( rhs : number ) : Color
Multiply each color channel of the current color by a specified value and return a new color.
Color.AddAssign ( rhs : Color ) : void
Adds the specified color to the current color.
Color.SubAssign ( rhs : Color ) : void
Subtracts the specified color from the current color.
Color.MulAssign ( rhs : number ) : void
Multiply each color channel of the current color by a specified value.
Color.EqualsTo ( other : Color ) : boolean
Determines whether the current color is equal to the specified color.

静态方法

Color.Clone ( val : Color ) : Color
Clone a color object from the specified color object.
Color.EqualsTo ( lhs : Color , rhs : Color ) : boolean
Determines whether the current color is equal to the specified color.