Color
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
Creates a new instance of Color from an r, g, b, a
Parameters
r: number
The red component of color (0-255)
g: number
The green component of color (0-255)
b: number
The blue component of color (0-255)
optionala: number
The alpha component of color (0-1.0)
Returns Color
Properties
publica
Alpha channel (between 0 and 1)
publicb
Blue channel
publicg
Green channel
publich
Hue
publicl
Lightness
publicr
Red channel
publics
Saturation
Accessors
publicstaticAzure
Azure (#007FFF)
Returns Color
publicstaticBlack
Black (#000000)
Returns Color
publicstaticBlue
Blue (#0000FF)
Returns Color
publicstaticBrown
Brown (#964B00)
Returns Color
publicstaticChartreuse
Chartreuse (#7FFF00)
Returns Color
publicstaticCyan
Cyan (#00FFFF)
Returns Color
publicstaticDarkGray
Dark gray (#A9A9A9)
Returns Color
publicstaticExcaliburBlue
ExcaliburBlue (#176BAA)
Returns Color
publicstaticGray
Gray (#808080)
Returns Color
publicstaticGreen
Green (#00FF00)
Returns Color
publicstaticLightGray
Light gray (#D3D3D3)
Returns Color
publicstaticMagenta
Magenta (#FF00FF)
Returns Color
publicstaticOrange
Orange (#FFA500)
Returns Color
publicstaticPink
Pink (#FFC0CB)
Returns Color
publicstaticPurple
Purple (#800080)
Returns Color
publicstaticRed
Red (#FF0000)
Returns Color
publicstaticRose
Rose (#FF007F)
Returns Color
publicstaticTeal
Teal (#008080)
Returns Color
publicstaticTransparent
Transparent (#FFFFFF00)
Returns Color
publicstaticVermilion
Vermilion (#FF5B31)
Returns Color
publicstaticViolet
Violet (#7F00FF)
Returns Color
publicstaticViridian
Viridian (#59978F)
Returns Color
publicstaticWhite
White (#FFFFFF)
Returns Color
publicstaticYellow
Yellow (#FFFF00)
Returns Color
Methods
publicaverage
publicclone
publicdarken
Darkens the current color by a specified amount
Parameters
factor: number = 0.1
The amount to darken by [0-1]
Returns Color
publicdesaturate
Desaturates the current color by a specified amount
Parameters
factor: number = 0.1
The amount to desaturate by [0-1]
Returns Color
publicequal
Parameters
color: Color
Returns boolean
publicfillStyle
Returns a CSS string representation of a color.
Returns string
publicinvert
Inverts the current color
Returns Color
publiclighten
Lightens the current color by a specified amount
Parameters
factor: number = 0.1
The amount to lighten by [0-1]
Returns Color
publicmultiply
publicsaturate
Saturates the current color by a specified amount
Parameters
factor: number = 0.1
The amount to saturate by [0-1]
Returns Color
publicscreen
publictoHSLA
Return HSLA representation of a color.
Returns string
publictoHex
Return Hex representation of a color.
Returns string
publictoRGBA
Return RGBA representation of a color.
Returns string
publictoString
Returns a CSS string representation of a color.
Parameters
format: rgb | hsl | hex = 'rgb'
Color representation, accepts: rgb, hsl, or hex
Returns string
publicstaticfromHSL
Creates a new instance of Color from hsla values
Parameters
h: number
Hue is represented [0-1]
s: number
Saturation is represented [0-1]
l: number
Luminance is represented [0-1]
a: number = 1.0
Alpha is represented [0-1]
Returns Color
publicstaticfromHex
Creates a new instance of Color from a hex string
Parameters
hex: string
CSS color string of the form #ffffff, the alpha component is optional
Returns Color
publicstaticfromRGB
Creates a new instance of Color from an r, g, b, a
Parameters
r: number
The red component of color (0-255)
g: number
The green component of color (0-255)
b: number
The blue component of color (0-255)
optionala: number
The alpha component of color (0-1.0)
Returns Color
publicstaticfromRGBString
Creates a new instance of Color from a rgb string
Parameters
string: string
CSS color string of the form rgba(255, 255, 255, 1) or rgb(255, 255, 255)
Returns Color
Provides standard colors (e.g. Color.Black) but you can also create custom colors using RGB, HSL, or Hex. Also provides useful color operations like Color.lighten, Color.darken, and more.