Represents a color. See also {@link ColorUtils}.
Methods
public add(color: Color): Color
Parameters
Returns
Color
public addColors(color1: Color, color2: Color): Color
Parameters
Returns
Color
public addScalar(s: number): Color
Parameters
Returns
Color
public clone(): Color
Clones this color.
Returns
Color
public convertGammaToLinear(): Color
Converts this color from gamma to linear space.
Returns
Color
public convertLinearToGamma(): Color
Converts this color from linear to gamma space.
Returns
Color
public copy(color: Color): Color
Copies given color.
Parameters
Returns
Color
public copyGammaToLinear(color: Color): Color
Copies given color making conversion from gamma to linear space.
Parameters
Returns
Color
public copyLinearToGamma(color: Color): Color
Copies given color making conversion from linear to gamma space.
Parameters
Returns
Color
public equals(color: Color): boolean
Parameters
Returns
boolean
public getHSL(): HSL
Returns
HSL
public getHex(): number
Returns the hexadecimal value of this color.
Returns
number
public getHexString(): string
Returns the string formated hexadecimal value of this color.
Returns
string
public getStyle(): string
Returns the value of this color in CSS context style.
Example: rgb(r, g, b)
Returns
string
public lerp(color: Color, alpha: number): Color
Parameters
Returns
Color
public multiply(color: Color): Color
Parameters
Returns
Color
public multiplyScalar(s: number): Color
Parameters
Returns
Color
public offsetHSL(h: number, s: number, l: number): Color
Parameters
-
h: number
-
s: number
-
l: number
Returns
Color
public set(color: Color): Color
Parameters
Returns
Color
public set(color: number): Color
Parameters
Returns
Color
public set(color: string): Color
Parameters
Returns
Color
public setHSL(h: number, s: number, l: number): Color
Sets this color from HSL values.
Based on MochiKit implementation by Bob Ippolito.
Parameters
-
h: number
Hue channel value between 0 and 1.
-
s: number
Saturation value channel between 0 and 1.
-
l: number
Value channel value between 0 and 1.
Returns
Color
public setHex(hex: number): Color
Parameters
Returns
Color
public setRGB(r: number, g: number, b: number): Color
Sets this color from RGB values.
Parameters
-
r: number
Red channel value between 0 and 1.
-
g: number
Green channel value between 0 and 1.
-
b: number
Blue channel value between 0 and 1.
Returns
Color
public setStyle(style: string): Color
Sets this color from a CSS context style string.
Parameters
Returns
Color