Class: Color
RGBA Color Object
Constructors
Properties
- COLOR_RED
- COLOR_GREEN
- COLOR_BLUE
- COLOR_WHITE
- r
- g
- b
- a
- PRIMARY
- PRIMARYDARK
- ACCENT
- WHITE
- IVORY
- LIGHTYELLOW
- YELLOW
- SNOW
- FLORALWHITE
- LEMONCHIFFON
- CORNSILK
- SEASHELL
- LAVENDERBLUSH
- PAPAYAWHIP
- BLANCHEDALMOND
- MISTYROSE
- BISQUE
- MOCCASIN
- NAVAJOWHITE
- PEACHPUFF
- GOLD
- PINK
- LIGHTPINK
- ORANGE
- LIGHTSALMON
- DARKORANGE
- CORAL
- HOTPINK
- TOMATO
- ORANGERED
- DEEPPINK
- FUCHSIA
- MAGENTA
- RED
- OLDLACE
- LIGHTGOLDENRODYELLOW
- LINEN
- ANTIQUEWHITE
- SALMON
- GHOSTWHITE
- MINTCREAM
- WHITESMOKE
- BEIGE
- WHEAT
- SANDYBROWN
- AZURE
- HONEYDEW
- ALICEBLUE
- KHAKI
- LIGHTCORAL
- PALEGOLDENROD
- VIOLET
- DARKSALMON
- LAVENDER
- LIGHTCYAN
- BURLYWOOD
- PLUM
- GAINSBORO
- CRIMSON
- PALEVIOLETRED
- GOLDENROD
- ORCHID
- THISTLE
- LIGHTGREY
- TAN
- CHOCOLATE
- PERU
- INDIANRED
- MEDIUMVIOLETRED
- SILVER
- DARKKHAKI
- ROSYBROWN
- MEDIUMORCHID
- DARKGOLDENROD
- FIREBRICK
- POWDERBLUE
- LIGHTSTEELBLUE
- PALETURQUOISE
- GREENYELLOW
- LIGHTBLUE
- DARKGRAY
- BROWN
- SIENNA
- DARKORCHID
- PALEGREEN
- DARKVIOLET
- MEDIUMPURPLE
- LIGHTGREEN
- DARKSEAGREEN
- SADDLEBROWN
- DARKMAGENTA
- DARKRED
- BLUEVIOLET
- LIGHTSKYBLUE
- SKYBLUE
- GRAY
- OLIVE
- PURPLE
- MAROON
- AQUAMARINE
- CHARTREUSE
- LAWNGREEN
- MEDIUMSLATEBLUE
- LIGHTSLATEGRAY
- SLATEGRAY
- OLIVEDRAB
- SLATEBLUE
- DIMGRAY
- MEDIUMAQUAMARINE
- CORNFLOWERBLUE
- CADETBLUE
- DARKOLIVEGREEN
- INDIGO
- MEDIUMTURQUOISE
- DARKSLATEBLUE
- STEELBLUE
- ROYALBLUE
- TURQUOISE
- MEDIUMSEAGREEN
- LIMEGREEN
- DARKSLATEGRAY
- SEAGREEN
- FORESTGREEN
- LIGHTSEAGREEN
- DODGERBLUE
- MIDNIGHTBLUE
- AQUA
- CYAN
- SPRINGGREEN
- LIME
- MEDIUMSPRINGGREEN
- DARKTURQUOISE
- DEEPSKYBLUE
- DARKCYAN
- TEAL
- GREEN
- DARKGREEN
- BLUE
- MEDIUMBLUE
- DARKBLUE
- NAVY
- BLACK
Accessors
Methods
- convertToHDRRGB
- unSerialized
- hexToRGB
- hexToRGBA
- random
- randomRGB
- randomGray
- setTo
- setHex
- getHex
- clone
- copyFrom
- copyFromArray
- copyFromVector
- hexRGBColor
- lerp
Constructors
constructor
• new Color(r?
, g?
, b?
, a?
): Color
create new color instance
Parameters
Name | Type | Default value | Description |
---|---|---|---|
r | number | 1.0 | red channel |
g | number | 1.0 | green channel |
b | number | 1.0 | blue channel |
a | number | 1.0 | alpha channel |
Returns
Defined in
Properties
COLOR_RED
▪ Static
COLOR_RED: Color
red color
Defined in
COLOR_GREEN
▪ Static
COLOR_GREEN: Color
green color
Defined in
COLOR_BLUE
▪ Static
COLOR_BLUE: Color
blue color
Defined in
COLOR_WHITE
▪ Static
COLOR_WHITE: Color
white color
Defined in
r
• r: number
= 0
red channel
Defined in
g
• g: number
= 0
green channel
Defined in
b
• b: number
= 0
blue channel
Defined in
a
• a: number
= 0
alpha channel
Defined in
PRIMARY
▪ Static
PRIMARY: number
= 0x3f51b5
Defined in
PRIMARYDARK
▪ Static
PRIMARYDARK: number
= 0x303f9f
Defined in
ACCENT
▪ Static
ACCENT: number
= 0xff4081
Defined in
WHITE
▪ Static
WHITE: number
= 0xffffff
Defined in
IVORY
▪ Static
IVORY: number
= 0xfffff0
Defined in
LIGHTYELLOW
▪ Static
LIGHTYELLOW: number
= 0xffffe0
Defined in
YELLOW
▪ Static
YELLOW: number
= 0xffff00
Defined in
SNOW
▪ Static
SNOW: number
= 0xfffafa
Defined in
FLORALWHITE
▪ Static
FLORALWHITE: number
= 0xfffaf0
Defined in
LEMONCHIFFON
▪ Static
LEMONCHIFFON: number
= 0xfffacd
Defined in
CORNSILK
▪ Static
CORNSILK: number
= 0xfff8dc
Defined in
SEASHELL
▪ Static
SEASHELL: number
= 0xfff5ee
Defined in
LAVENDERBLUSH
▪ Static
LAVENDERBLUSH: number
= 0xfff0f5
Defined in
PAPAYAWHIP
▪ Static
PAPAYAWHIP: number
= 0xffefd5
Defined in
BLANCHEDALMOND
▪ Static
BLANCHEDALMOND: number
= 0xffebcd
Defined in
MISTYROSE
▪ Static
MISTYROSE: number
= 0xffe4e1
Defined in
BISQUE
▪ Static
BISQUE: number
= 0xffe4c4
Defined in
MOCCASIN
▪ Static
MOCCASIN: number
= 0xffe4b5
Defined in
NAVAJOWHITE
▪ Static
NAVAJOWHITE: number
= 0xffdead
Defined in
PEACHPUFF
▪ Static
PEACHPUFF: number
= 0xffdab9
Defined in
GOLD
▪ Static
GOLD: number
= 0xffd700
Defined in
PINK
▪ Static
PINK: number
= 0xffc0cb
Defined in
LIGHTPINK
▪ Static
LIGHTPINK: number
= 0xffb6c1
Defined in
ORANGE
▪ Static
ORANGE: number
= 0xffa500
Defined in
LIGHTSALMON
▪ Static
LIGHTSALMON: number
= 0xffa07a
Defined in
DARKORANGE
▪ Static
DARKORANGE: number
= 0xff8c00
Defined in
CORAL
▪ Static
CORAL: number
= 0xff7f50
Defined in
HOTPINK
▪ Static
HOTPINK: number
= 0xff69b4
Defined in
TOMATO
▪ Static
TOMATO: number
= 0xff6347
Defined in
ORANGERED
▪ Static
ORANGERED: number
= 0xff4500
Defined in
DEEPPINK
▪ Static
DEEPPINK: number
= 0xff1493
Defined in
FUCHSIA
▪ Static
FUCHSIA: number
= 0xff00ff
Defined in
MAGENTA
▪ Static
MAGENTA: number
= 0xff00ff
Defined in
RED
▪ Static
RED: number
= 0xff0000
Defined in
OLDLACE
▪ Static
OLDLACE: number
= 0xfdf5e6
Defined in
LIGHTGOLDENRODYELLOW
▪ Static
LIGHTGOLDENRODYELLOW: number
= 0xfafad2
Defined in
LINEN
▪ Static
LINEN: number
= 0xfaf0e6
Defined in
ANTIQUEWHITE
▪ Static
ANTIQUEWHITE: number
= 0xfaebd7
Defined in
SALMON
▪ Static
SALMON: number
= 0xfa8072
Defined in
GHOSTWHITE
▪ Static
GHOSTWHITE: number
= 0xf8f8ff
Defined in
MINTCREAM
▪ Static
MINTCREAM: number
= 0xf5fffa
Defined in
WHITESMOKE
▪ Static
WHITESMOKE: number
= 0xf5f5f5
Defined in
BEIGE
▪ Static
BEIGE: number
= 0xf5f5dc
Defined in
WHEAT
▪ Static
WHEAT: number
= 0xf5deb3
Defined in
SANDYBROWN
▪ Static
SANDYBROWN: number
= 0xf4a460
Defined in
AZURE
▪ Static
AZURE: number
= 0xf0ffff
Defined in
HONEYDEW
▪ Static
HONEYDEW: number
= 0xf0fff0
Defined in
ALICEBLUE
▪ Static
ALICEBLUE: number
= 0xf0f8ff
Defined in
KHAKI
▪ Static
KHAKI: number
= 0xf0e68c
Defined in
LIGHTCORAL
▪ Static
LIGHTCORAL: number
= 0xf08080
Defined in
PALEGOLDENROD
▪ Static
PALEGOLDENROD: number
= 0xeee8aa
Defined in
VIOLET
▪ Static
VIOLET: number
= 0xee82ee
Defined in
DARKSALMON
▪ Static
DARKSALMON: number
= 0xe9967a
Defined in
LAVENDER
▪ Static
LAVENDER: number
= 0xe6e6fa
Defined in
LIGHTCYAN
▪ Static
LIGHTCYAN: number
= 0xe0ffff
Defined in
BURLYWOOD
▪ Static
BURLYWOOD: number
= 0xdeb887
Defined in
PLUM
▪ Static
PLUM: number
= 0xdda0dd
Defined in
GAINSBORO
▪ Static
GAINSBORO: number
= 0xdcdcdc
Defined in
CRIMSON
▪ Static
CRIMSON: number
= 0xdc143c
Defined in
PALEVIOLETRED
▪ Static
PALEVIOLETRED: number
= 0xdb7093
Defined in
GOLDENROD
▪ Static
GOLDENROD: number
= 0xdaa520
Defined in
ORCHID
▪ Static
ORCHID: number
= 0xda70d6
Defined in
THISTLE
▪ Static
THISTLE: number
= 0xd8bfd8
Defined in
LIGHTGREY
▪ Static
LIGHTGREY: number
= 0xd3d3d3
Defined in
TAN
▪ Static
TAN: number
= 0xd2b48c
Defined in
CHOCOLATE
▪ Static
CHOCOLATE: number
= 0xd2691e
Defined in
PERU
▪ Static
PERU: number
= 0xcd853f
Defined in
INDIANRED
▪ Static
INDIANRED: number
= 0xcd5c5c
Defined in
MEDIUMVIOLETRED
▪ Static
MEDIUMVIOLETRED: number
= 0xc71585
Defined in
SILVER
▪ Static
SILVER: number
= 0xc0c0c0
Defined in
DARKKHAKI
▪ Static
DARKKHAKI: number
= 0xbdb76b
Defined in
ROSYBROWN
▪ Static
ROSYBROWN: number
= 0xbc8f8f
Defined in
MEDIUMORCHID
▪ Static
MEDIUMORCHID: number
= 0xba55d3
Defined in
DARKGOLDENROD
▪ Static
DARKGOLDENROD: number
= 0xb8860b
Defined in
FIREBRICK
▪ Static
FIREBRICK: number
= 0xb22222
Defined in
POWDERBLUE
▪ Static
POWDERBLUE: number
= 0xb0e0e6
Defined in
LIGHTSTEELBLUE
▪ Static
LIGHTSTEELBLUE: number
= 0xb0c4de
Defined in
PALETURQUOISE
▪ Static
PALETURQUOISE: number
= 0xafeeee
Defined in
GREENYELLOW
▪ Static
GREENYELLOW: number
= 0xadff2f
Defined in
LIGHTBLUE
▪ Static
LIGHTBLUE: number
= 0xadd8e6
Defined in
DARKGRAY
▪ Static
DARKGRAY: number
= 0xa9a9a9
Defined in
BROWN
▪ Static
BROWN: number
= 0xa52a2a
Defined in
SIENNA
▪ Static
SIENNA: number
= 0xa0522d
Defined in
DARKORCHID
▪ Static
DARKORCHID: number
= 0x9932cc
Defined in
PALEGREEN
▪ Static
PALEGREEN: number
= 0x98fb98
Defined in
DARKVIOLET
▪ Static
DARKVIOLET: number
= 0x9400d3
Defined in
MEDIUMPURPLE
▪ Static
MEDIUMPURPLE: number
= 0x9370db
Defined in
LIGHTGREEN
▪ Static
LIGHTGREEN: number
= 0x90ee90
Defined in
DARKSEAGREEN
▪ Static
DARKSEAGREEN: number
= 0x8fbc8f
Defined in
SADDLEBROWN
▪ Static
SADDLEBROWN: number
= 0x8b4513
Defined in
DARKMAGENTA
▪ Static
DARKMAGENTA: number
= 0x8b008b
Defined in
DARKRED
▪ Static
DARKRED: number
= 0x8b0000
Defined in
BLUEVIOLET
▪ Static
BLUEVIOLET: number
= 0x8a2be2
Defined in
LIGHTSKYBLUE
▪ Static
LIGHTSKYBLUE: number
= 0x87cefa
Defined in
SKYBLUE
▪ Static
SKYBLUE: number
= 0x87ceeb
Defined in
GRAY
▪ Static
GRAY: number
= 0x808080
Defined in
OLIVE
▪ Static
OLIVE: number
= 0x808000
Defined in
PURPLE
▪ Static
PURPLE: number
= 0x800080
Defined in
MAROON
▪ Static
MAROON: number
= 0x800000
Defined in
AQUAMARINE
▪ Static
AQUAMARINE: number
= 0x7fffd4
Defined in
CHARTREUSE
▪ Static
CHARTREUSE: number
= 0x7fff00
Defined in
LAWNGREEN
▪ Static
LAWNGREEN: number
= 0x7cfc00
Defined in
MEDIUMSLATEBLUE
▪ Static
MEDIUMSLATEBLUE: number
= 0x7b68ee
Defined in
LIGHTSLATEGRAY
▪ Static
LIGHTSLATEGRAY: number
= 0x778899
Defined in
SLATEGRAY
▪ Static
SLATEGRAY: number
= 0x708090
Defined in
OLIVEDRAB
▪ Static
OLIVEDRAB: number
= 0x6b8e23
Defined in
SLATEBLUE
▪ Static
SLATEBLUE: number
= 0x6a5acd
Defined in
DIMGRAY
▪ Static
DIMGRAY: number
= 0x696969
Defined in
MEDIUMAQUAMARINE
▪ Static
MEDIUMAQUAMARINE: number
= 0x66cdaa
Defined in
CORNFLOWERBLUE
▪ Static
CORNFLOWERBLUE: number
= 0x6495ed
Defined in
CADETBLUE
▪ Static
CADETBLUE: number
= 0x5f9ea0
Defined in
DARKOLIVEGREEN
▪ Static
DARKOLIVEGREEN: number
= 0x556b2f
Defined in
INDIGO
▪ Static
INDIGO: number
= 0x4b0082
Defined in
MEDIUMTURQUOISE
▪ Static
MEDIUMTURQUOISE: number
= 0x48d1cc
Defined in
DARKSLATEBLUE
▪ Static
DARKSLATEBLUE: number
= 0x483d8b
Defined in
STEELBLUE
▪ Static
STEELBLUE: number
= 0x4682b4
Defined in
ROYALBLUE
▪ Static
ROYALBLUE: number
= 0x4169e1
Defined in
TURQUOISE
▪ Static
TURQUOISE: number
= 0x40e0d0
Defined in
MEDIUMSEAGREEN
▪ Static
MEDIUMSEAGREEN: number
= 0x3cb371
Defined in
LIMEGREEN
▪ Static
LIMEGREEN: number
= 0x32cd32
Defined in
DARKSLATEGRAY
▪ Static
DARKSLATEGRAY: number
= 0x2f4f4f
Defined in
SEAGREEN
▪ Static
SEAGREEN: number
= 0x2e8b57
Defined in
FORESTGREEN
▪ Static
FORESTGREEN: number
= 0x228b22
Defined in
LIGHTSEAGREEN
▪ Static
LIGHTSEAGREEN: number
= 0x20b2aa
Defined in
DODGERBLUE
▪ Static
DODGERBLUE: number
= 0x1e90ff
Defined in
MIDNIGHTBLUE
▪ Static
MIDNIGHTBLUE: number
= 0x191970
Defined in
AQUA
▪ Static
AQUA: number
= 0x00ffff
Defined in
CYAN
▪ Static
CYAN: number
= 0x00ffff
Defined in
SPRINGGREEN
▪ Static
SPRINGGREEN: number
= 0x00ff7f
Defined in
LIME
▪ Static
LIME: number
= 0x00ff00
Defined in
MEDIUMSPRINGGREEN
▪ Static
MEDIUMSPRINGGREEN: number
= 0x00fa9a
Defined in
DARKTURQUOISE
▪ Static
DARKTURQUOISE: number
= 0x00ced1
Defined in
DEEPSKYBLUE
▪ Static
DEEPSKYBLUE: number
= 0x00bfff
Defined in
DARKCYAN
▪ Static
DARKCYAN: number
= 0x008b8b
Defined in
TEAL
▪ Static
TEAL: number
= 0x008080
Defined in
GREEN
▪ Static
GREEN: number
= 0x008000
Defined in
DARKGREEN
▪ Static
DARKGREEN: number
= 0x006400
Defined in
BLUE
▪ Static
BLUE: number
= 0x0000ff
Defined in
MEDIUMBLUE
▪ Static
MEDIUMBLUE: number
= 0x0000cd
Defined in
DARKBLUE
▪ Static
DARKBLUE: number
= 0x00008b
Defined in
NAVY
▪ Static
NAVY: number
= 0x000080
Defined in
BLACK
▪ Static
BLACK: number
= 0x000000
Defined in
Accessors
rgb
• get
rgb(): number
[]
get rgb to array
Returns
number
[]
Defined in
• set
rgb(c
): void
set rgb by array
Parameters
Name | Type |
---|---|
c | number [] |
Returns
void
Defined in
rgba
• get
rgba(): number
[]
get rgba to array
Returns
number
[]
Defined in
• set
rgba(c
): void
set rgb by array
Parameters
Name | Type |
---|---|
c | number [] |
Returns
void
Defined in
Methods
convertToHDRRGB
▸ convertToHDRRGB(): Color
convert to hdr color , channel a is intensity
Returns
Defined in
unSerialized
▸ unSerialized(data
): this
unSerialized color by data
Parameters
Name | Type |
---|---|
data | any |
Returns
this
Defined in
hexToRGB
▸ hexToRGB(value
): Color
update this color rgb from hexadecimal no alpha
Parameters
Name | Type |
---|---|
value | number |
Returns
Defined in
hexToRGBA
▸ hexToRGBA(value
): Color
update this color rgb from hexadecimal has alpha
Parameters
Name | Type |
---|---|
value | number |
Returns
Defined in
random
▸ random(base?
): Color
random on color
Parameters
Name | Type | Default value |
---|---|---|
base | number | 1.0 |
Returns
Defined in
randomRGB
▸ randomRGB(seedR?
, seedG?
, seedB?
, baseR?
, baseG?
, baseB?
): Color
Parameters
Name | Type | Default value |
---|---|---|
seedR | number | 0.5 |
seedG | number | 0.5 |
seedB | number | 0.5 |
baseR | number | 0.5 |
baseG | number | 0.5 |
baseB | number | 0.5 |
Returns
Defined in
randomGray
▸ randomGray(base?
, random?
): Color
random on color
Parameters
Name | Type | Default value |
---|---|---|
base | number | 0.5 |
random | number | 0.5 |
Returns
Defined in
setTo
▸ setTo(r
, g
, b
, a
): void
set rgba to this color
Parameters
Name | Type | Description |
---|---|---|
r | number | red channel |
g | number | green channel |
b | number | blue channel |
a | number | alpha channel |
Returns
void
Defined in
setHex
▸ setHex(hex
): void
update this color rgba from hexadecimal
Parameters
Name | Type | Description |
---|---|---|
hex | string | hex string. |
Returns
void
Defined in
getHex
▸ getHex(): string
convert this color to hex string code
Returns
string
Defined in
clone
▸ clone(): Color
clone this color
Returns
Defined in
copyFrom
▸ copyFrom(src
): this
copy color from source color
Parameters
Name | Type |
---|---|
src | Color |
Returns
this
Defined in
copyFromArray
▸ copyFromArray(arr
, scalar?
): Color
copy color from array
Parameters
Name | Type | Default value | Description |
---|---|---|---|
arr | number [] | undefined | [ 255 , 255 , 255 , 255 ] |
scalar | number | 255 |
Returns
Defined in
copyFromVector
▸ copyFromVector(value
): this
copy color from vector3 or vector4
Parameters
Name | Type | Description |
---|---|---|
value | Object | { x: number, y: number, z: number, w?: number } |
value.x | number | - |
value.y | number | - |
value.z | number | - |
value.w? | number | - |
Returns
this
Defined in
hexRGBColor
▸ hexRGBColor(hexColor
, dst?
): Color
update this color rgb from hexadecimal no alpha
Parameters
Name | Type | Default value | Description |
---|---|---|---|
hexColor | number | undefined | rgb color |
dst | Color | null | ref out color |
Returns
Defined in
lerp
▸ lerp(v
, c1
, c2
, target?
): Color
lerp two color
Parameters
Name | Type |
---|---|
v | number |
c1 | Color |
c2 | Color |
target? | Color |