Class: Color
Defined in: src/math/Color.ts:5
RGBA Color Object
Constructors
Constructor
new Color(
r?,g?,b?,a?):Color
Defined in: src/math/Color.ts:92
create new color instance
Parameters
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
Color
Properties
COLOR_RED
staticCOLOR_RED:Color
Defined in: src/math/Color.ts:10
red color
COLOR_GREEN
staticCOLOR_GREEN:Color
Defined in: src/math/Color.ts:15
green color
COLOR_BLUE
staticCOLOR_BLUE:Color
Defined in: src/math/Color.ts:20
blue color
COLOR_WHITE
staticCOLOR_WHITE:Color
Defined in: src/math/Color.ts:25
white color
r
r:
number=0
Defined in: src/math/Color.ts:68
red channel
g
g:
number=0
Defined in: src/math/Color.ts:73
green channel
b
b:
number=0
Defined in: src/math/Color.ts:78
blue channel
a
a:
number=0
Defined in: src/math/Color.ts:83
alpha channel
PRIMARY
staticPRIMARY:number=0x3f51b5
Defined in: src/math/Color.ts:359
Preset color: primary.
PRIMARYDARK
staticPRIMARYDARK:number=0x303f9f
Defined in: src/math/Color.ts:361
Preset color: primary dark.
ACCENT
staticACCENT:number=0xff4081
Defined in: src/math/Color.ts:363
Preset color: accent.
WHITE
staticWHITE:number=0xffffff
Defined in: src/math/Color.ts:366
Preset color: white.
IVORY
staticIVORY:number=0xfffff0
Defined in: src/math/Color.ts:368
Preset color: ivory.
LIGHTYELLOW
staticLIGHTYELLOW:number=0xffffe0
Defined in: src/math/Color.ts:370
Preset color: light yellow.
YELLOW
staticYELLOW:number=0xffff00
Defined in: src/math/Color.ts:372
Preset color: yellow.
SNOW
staticSNOW:number=0xfffafa
Defined in: src/math/Color.ts:374
Preset color: snow.
FLORALWHITE
staticFLORALWHITE:number=0xfffaf0
Defined in: src/math/Color.ts:376
Preset color: floral white.
LEMONCHIFFON
staticLEMONCHIFFON:number=0xfffacd
Defined in: src/math/Color.ts:378
Preset color: lemon chiffon.
CORNSILK
staticCORNSILK:number=0xfff8dc
Defined in: src/math/Color.ts:380
Preset color: cornsilk.
SEASHELL
staticSEASHELL:number=0xfff5ee
Defined in: src/math/Color.ts:382
Preset color: seashell.
LAVENDERBLUSH
staticLAVENDERBLUSH:number=0xfff0f5
Defined in: src/math/Color.ts:384
Preset color: lavender blush.
PAPAYAWHIP
staticPAPAYAWHIP:number=0xffefd5
Defined in: src/math/Color.ts:386
Preset color: papaya whip.
BLANCHEDALMOND
staticBLANCHEDALMOND:number=0xffebcd
Defined in: src/math/Color.ts:388
Preset color: blanched almond.
MISTYROSE
staticMISTYROSE:number=0xffe4e1
Defined in: src/math/Color.ts:390
Preset color: misty rose.
BISQUE
staticBISQUE:number=0xffe4c4
Defined in: src/math/Color.ts:392
Preset color: bisque.
MOCCASIN
staticMOCCASIN:number=0xffe4b5
Defined in: src/math/Color.ts:394
Preset color: moccasin.
NAVAJOWHITE
staticNAVAJOWHITE:number=0xffdead
Defined in: src/math/Color.ts:396
Preset color: navajo white.
PEACHPUFF
staticPEACHPUFF:number=0xffdab9
Defined in: src/math/Color.ts:398
Preset color: peach puff.
GOLD
staticGOLD:number=0xffd700
Defined in: src/math/Color.ts:400
Preset color: gold.
PINK
staticPINK:number=0xffc0cb
Defined in: src/math/Color.ts:402
Preset color: pink.
LIGHTPINK
staticLIGHTPINK:number=0xffb6c1
Defined in: src/math/Color.ts:404
Preset color: light pink.
ORANGE
staticORANGE:number=0xffa500
Defined in: src/math/Color.ts:406
Preset color: orange.
LIGHTSALMON
staticLIGHTSALMON:number=0xffa07a
Defined in: src/math/Color.ts:408
Preset color: light salmon.
DARKORANGE
staticDARKORANGE:number=0xff8c00
Defined in: src/math/Color.ts:410
Preset color: dark orange.
CORAL
staticCORAL:number=0xff7f50
Defined in: src/math/Color.ts:412
Preset color: coral.
HOTPINK
staticHOTPINK:number=0xff69b4
Defined in: src/math/Color.ts:414
Preset color: hot pink.
TOMATO
staticTOMATO:number=0xff6347
Defined in: src/math/Color.ts:416
Preset color: tomato.
ORANGERED
staticORANGERED:number=0xff4500
Defined in: src/math/Color.ts:418
Preset color: orange red.
DEEPPINK
staticDEEPPINK:number=0xff1493
Defined in: src/math/Color.ts:420
Preset color: deep pink.
FUCHSIA
staticFUCHSIA:number=0xff00ff
Defined in: src/math/Color.ts:422
Preset color: fuchsia.
MAGENTA
staticMAGENTA:number=0xff00ff
Defined in: src/math/Color.ts:424
Preset color: magenta.
RED
staticRED:number=0xff0000
Defined in: src/math/Color.ts:426
Preset color: red.
OLDLACE
staticOLDLACE:number=0xfdf5e6
Defined in: src/math/Color.ts:428
Preset color: old lace.
LIGHTGOLDENRODYELLOW
staticLIGHTGOLDENRODYELLOW:number=0xfafad2
Defined in: src/math/Color.ts:430
Preset color: light goldenrod yellow.
LINEN
staticLINEN:number=0xfaf0e6
Defined in: src/math/Color.ts:432
Preset color: linen.
ANTIQUEWHITE
staticANTIQUEWHITE:number=0xfaebd7
Defined in: src/math/Color.ts:434
Preset color: antique white.
SALMON
staticSALMON:number=0xfa8072
Defined in: src/math/Color.ts:436
Preset color: salmon.
GHOSTWHITE
staticGHOSTWHITE:number=0xf8f8ff
Defined in: src/math/Color.ts:438
Preset color: ghost white.
MINTCREAM
staticMINTCREAM:number=0xf5fffa
Defined in: src/math/Color.ts:440
Preset color: mint cream.
WHITESMOKE
staticWHITESMOKE:number=0xf5f5f5
Defined in: src/math/Color.ts:442
Preset color: white smoke.
BEIGE
staticBEIGE:number=0xf5f5dc
Defined in: src/math/Color.ts:444
Preset color: beige.
WHEAT
staticWHEAT:number=0xf5deb3
Defined in: src/math/Color.ts:446
Preset color: wheat.
SANDYBROWN
staticSANDYBROWN:number=0xf4a460
Defined in: src/math/Color.ts:448
Preset color: sandy brown.
AZURE
staticAZURE:number=0xf0ffff
Defined in: src/math/Color.ts:450
Preset color: azure.
HONEYDEW
staticHONEYDEW:number=0xf0fff0
Defined in: src/math/Color.ts:452
Preset color: honeydew.
ALICEBLUE
staticALICEBLUE:number=0xf0f8ff
Defined in: src/math/Color.ts:454
Preset color: alice blue.
KHAKI
staticKHAKI:number=0xf0e68c
Defined in: src/math/Color.ts:456
Preset color: khaki.
LIGHTCORAL
staticLIGHTCORAL:number=0xf08080
Defined in: src/math/Color.ts:458
Preset color: light coral.
PALEGOLDENROD
staticPALEGOLDENROD:number=0xeee8aa
Defined in: src/math/Color.ts:460
Preset color: pale goldenrod.
VIOLET
staticVIOLET:number=0xee82ee
Defined in: src/math/Color.ts:462
Preset color: violet.
DARKSALMON
staticDARKSALMON:number=0xe9967a
Defined in: src/math/Color.ts:464
Preset color: dark salmon.
LAVENDER
staticLAVENDER:number=0xe6e6fa
Defined in: src/math/Color.ts:466
Preset color: lavender.
LIGHTCYAN
staticLIGHTCYAN:number=0xe0ffff
Defined in: src/math/Color.ts:468
Preset color: light cyan.
BURLYWOOD
staticBURLYWOOD:number=0xdeb887
Defined in: src/math/Color.ts:470
Preset color: burlywood.
PLUM
staticPLUM:number=0xdda0dd
Defined in: src/math/Color.ts:472
Preset color: plum.
GAINSBORO
staticGAINSBORO:number=0xdcdcdc
Defined in: src/math/Color.ts:474
Preset color: gainsboro.
CRIMSON
staticCRIMSON:number=0xdc143c
Defined in: src/math/Color.ts:476
Preset color: crimson.
PALEVIOLETRED
staticPALEVIOLETRED:number=0xdb7093
Defined in: src/math/Color.ts:478
Preset color: pale violet red.
GOLDENROD
staticGOLDENROD:number=0xdaa520
Defined in: src/math/Color.ts:481
Preset color: goldenrod.
ORCHID
staticORCHID:number=0xda70d6
Defined in: src/math/Color.ts:483
Preset color: orchid.
THISTLE
staticTHISTLE:number=0xd8bfd8
Defined in: src/math/Color.ts:485
Preset color: thistle.
LIGHTGREY
staticLIGHTGREY:number=0xd3d3d3
Defined in: src/math/Color.ts:487
Preset color: light grey.
TAN
staticTAN:number=0xd2b48c
Defined in: src/math/Color.ts:489
Preset color: tan.
CHOCOLATE
staticCHOCOLATE:number=0xd2691e
Defined in: src/math/Color.ts:491
Preset color: chocolate.
PERU
staticPERU:number=0xcd853f
Defined in: src/math/Color.ts:493
Preset color: peru.
INDIANRED
staticINDIANRED:number=0xcd5c5c
Defined in: src/math/Color.ts:495
Preset color: indian red.
MEDIUMVIOLETRED
staticMEDIUMVIOLETRED:number=0xc71585
Defined in: src/math/Color.ts:497
Preset color: medium violet red.
SILVER
staticSILVER:number=0xc0c0c0
Defined in: src/math/Color.ts:499
Preset color: silver.
DARKKHAKI
staticDARKKHAKI:number=0xbdb76b
Defined in: src/math/Color.ts:501
Preset color: dark khaki.
ROSYBROWN
staticROSYBROWN:number=0xbc8f8f
Defined in: src/math/Color.ts:503
Preset color: rosy brown.
MEDIUMORCHID
staticMEDIUMORCHID:number=0xba55d3
Defined in: src/math/Color.ts:505
Preset color: medium orchid.
DARKGOLDENROD
staticDARKGOLDENROD:number=0xb8860b
Defined in: src/math/Color.ts:507
Preset color: dark goldenrod.
FIREBRICK
staticFIREBRICK:number=0xb22222
Defined in: src/math/Color.ts:509
Preset color: firebrick.
POWDERBLUE
staticPOWDERBLUE:number=0xb0e0e6
Defined in: src/math/Color.ts:511
Preset color: powder blue.
LIGHTSTEELBLUE
staticLIGHTSTEELBLUE:number=0xb0c4de
Defined in: src/math/Color.ts:513
Preset color: light steel blue.
PALETURQUOISE
staticPALETURQUOISE:number=0xafeeee
Defined in: src/math/Color.ts:515
Preset color: pale turquoise.
GREENYELLOW
staticGREENYELLOW:number=0xadff2f
Defined in: src/math/Color.ts:517
Preset color: green yellow.
LIGHTBLUE
staticLIGHTBLUE:number=0xadd8e6
Defined in: src/math/Color.ts:519
Preset color: light blue.
DARKGRAY
staticDARKGRAY:number=0xa9a9a9
Defined in: src/math/Color.ts:521
Preset color: dark gray.
BROWN
staticBROWN:number=0xa52a2a
Defined in: src/math/Color.ts:523
Preset color: brown.
SIENNA
staticSIENNA:number=0xa0522d
Defined in: src/math/Color.ts:525
Preset color: sienna.
DARKORCHID
staticDARKORCHID:number=0x9932cc
Defined in: src/math/Color.ts:527
Preset color: dark orchid.
PALEGREEN
staticPALEGREEN:number=0x98fb98
Defined in: src/math/Color.ts:529
Preset color: pale green.
DARKVIOLET
staticDARKVIOLET:number=0x9400d3
Defined in: src/math/Color.ts:531
Preset color: dark violet.
MEDIUMPURPLE
staticMEDIUMPURPLE:number=0x9370db
Defined in: src/math/Color.ts:533
Preset color: medium purple.
LIGHTGREEN
staticLIGHTGREEN:number=0x90ee90
Defined in: src/math/Color.ts:535
Preset color: light green.
DARKSEAGREEN
staticDARKSEAGREEN:number=0x8fbc8f
Defined in: src/math/Color.ts:537
Preset color: dark sea green.
SADDLEBROWN
staticSADDLEBROWN:number=0x8b4513
Defined in: src/math/Color.ts:539
Preset color: saddle brown.
DARKMAGENTA
staticDARKMAGENTA:number=0x8b008b
Defined in: src/math/Color.ts:541
Preset color: dark magenta.
DARKRED
staticDARKRED:number=0x8b0000
Defined in: src/math/Color.ts:543
Preset color: dark red.
BLUEVIOLET
staticBLUEVIOLET:number=0x8a2be2
Defined in: src/math/Color.ts:545
Preset color: blue violet.
LIGHTSKYBLUE
staticLIGHTSKYBLUE:number=0x87cefa
Defined in: src/math/Color.ts:547
Preset color: light sky blue.
SKYBLUE
staticSKYBLUE:number=0x87ceeb
Defined in: src/math/Color.ts:549
Preset color: sky blue.
GRAY
staticGRAY:number=0x808080
Defined in: src/math/Color.ts:551
Preset color: gray.
OLIVE
staticOLIVE:number=0x808000
Defined in: src/math/Color.ts:553
Preset color: olive.
PURPLE
staticPURPLE:number=0x800080
Defined in: src/math/Color.ts:555
Preset color: purple.
MAROON
staticMAROON:number=0x800000
Defined in: src/math/Color.ts:557
Preset color: maroon.
AQUAMARINE
staticAQUAMARINE:number=0x7fffd4
Defined in: src/math/Color.ts:559
Preset color: aquamarine.
CHARTREUSE
staticCHARTREUSE:number=0x7fff00
Defined in: src/math/Color.ts:561
Preset color: chartreuse.
LAWNGREEN
staticLAWNGREEN:number=0x7cfc00
Defined in: src/math/Color.ts:563
Preset color: lawn green.
MEDIUMSLATEBLUE
staticMEDIUMSLATEBLUE:number=0x7b68ee
Defined in: src/math/Color.ts:565
Preset color: medium slate blue.
LIGHTSLATEGRAY
staticLIGHTSLATEGRAY:number=0x778899
Defined in: src/math/Color.ts:567
Preset color: light slate gray.
SLATEGRAY
staticSLATEGRAY:number=0x708090
Defined in: src/math/Color.ts:569
Preset color: slate gray.
OLIVEDRAB
staticOLIVEDRAB:number=0x6b8e23
Defined in: src/math/Color.ts:571
Preset color: olive drab.
SLATEBLUE
staticSLATEBLUE:number=0x6a5acd
Defined in: src/math/Color.ts:573
Preset color: slate blue.
DIMGRAY
staticDIMGRAY:number=0x696969
Defined in: src/math/Color.ts:575
Preset color: dim gray.
MEDIUMAQUAMARINE
staticMEDIUMAQUAMARINE:number=0x66cdaa
Defined in: src/math/Color.ts:577
Preset color: medium aquamarine.
CORNFLOWERBLUE
staticCORNFLOWERBLUE:number=0x6495ed
Defined in: src/math/Color.ts:579
Preset color: cornflower blue.
CADETBLUE
staticCADETBLUE:number=0x5f9ea0
Defined in: src/math/Color.ts:581
Preset color: cadet blue.
DARKOLIVEGREEN
staticDARKOLIVEGREEN:number=0x556b2f
Defined in: src/math/Color.ts:583
Preset color: dark olive green.
INDIGO
staticINDIGO:number=0x4b0082
Defined in: src/math/Color.ts:585
Preset color: indigo.
MEDIUMTURQUOISE
staticMEDIUMTURQUOISE:number=0x48d1cc
Defined in: src/math/Color.ts:587
Preset color: medium turquoise.
DARKSLATEBLUE
staticDARKSLATEBLUE:number=0x483d8b
Defined in: src/math/Color.ts:589
Preset color: dark slate blue.
STEELBLUE
staticSTEELBLUE:number=0x4682b4
Defined in: src/math/Color.ts:591
Preset color: steel blue.
ROYALBLUE
staticROYALBLUE:number=0x4169e1
Defined in: src/math/Color.ts:593
Preset color: royal blue.
TURQUOISE
staticTURQUOISE:number=0x40e0d0
Defined in: src/math/Color.ts:595
Preset color: turquoise.
MEDIUMSEAGREEN
staticMEDIUMSEAGREEN:number=0x3cb371
Defined in: src/math/Color.ts:597
Preset color: medium sea green.
LIMEGREEN
staticLIMEGREEN:number=0x32cd32
Defined in: src/math/Color.ts:599
Preset color: lime green.
DARKSLATEGRAY
staticDARKSLATEGRAY:number=0x2f4f4f
Defined in: src/math/Color.ts:601
Preset color: dark slate gray.
SEAGREEN
staticSEAGREEN:number=0x2e8b57
Defined in: src/math/Color.ts:603
Preset color: sea green.
FORESTGREEN
staticFORESTGREEN:number=0x228b22
Defined in: src/math/Color.ts:605
Preset color: forest green.
LIGHTSEAGREEN
staticLIGHTSEAGREEN:number=0x20b2aa
Defined in: src/math/Color.ts:607
Preset color: light sea green.
DODGERBLUE
staticDODGERBLUE:number=0x1e90ff
Defined in: src/math/Color.ts:609
Preset color: dodger blue.
MIDNIGHTBLUE
staticMIDNIGHTBLUE:number=0x191970
Defined in: src/math/Color.ts:611
Preset color: midnight blue.
AQUA
staticAQUA:number=0x00ffff
Defined in: src/math/Color.ts:613
Preset color: aqua.
CYAN
staticCYAN:number=0x00ffff
Defined in: src/math/Color.ts:615
Preset color: cyan.
SPRINGGREEN
staticSPRINGGREEN:number=0x00ff7f
Defined in: src/math/Color.ts:617
Preset color: spring green.
LIME
staticLIME:number=0x00ff00
Defined in: src/math/Color.ts:619
Preset color: lime.
MEDIUMSPRINGGREEN
staticMEDIUMSPRINGGREEN:number=0x00fa9a
Defined in: src/math/Color.ts:621
Preset color: medium spring green.
DARKTURQUOISE
staticDARKTURQUOISE:number=0x00ced1
Defined in: src/math/Color.ts:623
Preset color: dark turquoise.
DEEPSKYBLUE
staticDEEPSKYBLUE:number=0x00bfff
Defined in: src/math/Color.ts:625
Preset color: deep sky blue.
DARKCYAN
staticDARKCYAN:number=0x008b8b
Defined in: src/math/Color.ts:627
Preset color: dark cyan.
TEAL
staticTEAL:number=0x008080
Defined in: src/math/Color.ts:629
Preset color: teal.
GREEN
staticGREEN:number=0x008000
Defined in: src/math/Color.ts:631
Preset color: green.
DARKGREEN
staticDARKGREEN:number=0x006400
Defined in: src/math/Color.ts:633
Preset color: dark green.
BLUE
staticBLUE:number=0x0000ff
Defined in: src/math/Color.ts:635
Preset color: blue.
MEDIUMBLUE
staticMEDIUMBLUE:number=0x0000cd
Defined in: src/math/Color.ts:637
Preset color: medium blue.
DARKBLUE
staticDARKBLUE:number=0x00008b
Defined in: src/math/Color.ts:639
Preset color: dark blue.
NAVY
staticNAVY:number=0x000080
Defined in: src/math/Color.ts:641
Preset color: navy.
BLACK
staticBLACK:number=0x000000
Defined in: src/math/Color.ts:643
Preset color: black.
Accessors
rgb
Get Signature
get rgb():
number[]
Defined in: src/math/Color.ts:256
get rgb to array
Returns
number[]
Set Signature
set rgb(
c):void
Defined in: src/math/Color.ts:263
set rgb by array
Parameters
c
number[]
Returns
void
rgba
Get Signature
get rgba():
number[]
Defined in: src/math/Color.ts:270
get rgba to array
Returns
number[]
Set Signature
set rgba(
c):void
Defined in: src/math/Color.ts:277
set rgb by array
Parameters
c
number[]
Returns
void
Methods
convertToHDRRGB()
convertToHDRRGB():
Color
Defined in: src/math/Color.ts:99
convert to hdr color , channel a is intensity
Returns
Color
unSerialized()
unSerialized(
data):this
Defined in: src/math/Color.ts:111
unSerialized color by data
Parameters
data
any
Returns
this
hexToRGB()
hexToRGB(
value):Color
Defined in: src/math/Color.ts:123
update this color rgb from hexadecimal no alpha
Parameters
value
number
Returns
Color
hexToRGBA()
hexToRGBA(
value):Color
Defined in: src/math/Color.ts:135
update this color rgb from hexadecimal has alpha
Parameters
value
number
Returns
Color
random()
staticrandom(base?):Color
Defined in: src/math/Color.ts:147
random on color
Parameters
base?
number = 1.0
Returns
Color
randomRGB()
staticrandomRGB(seedR?,seedG?,seedB?,baseR?,baseG?,baseB?):Color
Defined in: src/math/Color.ts:160
generate a random color from per-channel seeds and base values
Parameters
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
Color
randomGray()
staticrandomGray(base?,random?):Color
Defined in: src/math/Color.ts:174
random on color
Parameters
base?
number = 0.5
random?
number = 0.5
Returns
Color
setTo()
setTo(
r,g,b,a):this
Defined in: src/math/Color.ts:191
set rgba to this color
Parameters
r
number
red channel
g
number
green channel
b
number
blue channel
a
number
alpha channel
Returns
this
setHex()
setHex(
hex):this
Defined in: src/math/Color.ts:203
update this color rgba from hexadecimal
Parameters
hex
string
hex string.
Returns
this
getHex()
getHex():
string
Defined in: src/math/Color.ts:240
convert this color to hex string code
Returns
string
clone()
clone():
Color
Defined in: src/math/Color.ts:285
clone this color
Returns
Color
copy()
copy(
src):this
Defined in: src/math/Color.ts:293
copy color from source color
Parameters
src
Color
Returns
this
copyFromArray()
copyFromArray(
arr,scalar?):this
Defined in: src/math/Color.ts:307
copy color from array
Parameters
arr
number[]
[ 255 , 255 , 255 , 255 ]
scalar?
number = 255
Returns
this
copyFromVector()
copyFromVector(
value):this
Defined in: src/math/Color.ts:321
copy color from vector3 or vector4
Parameters
value
{ x: number, y: number, z: number, w?: number }
x
number
y
number
z
number
w?
number
Returns
this
hexRGBColor()
statichexRGBColor(hexColor,dst?):Color
Defined in: src/math/Color.ts:334
update this color rgb from hexadecimal no alpha
Parameters
hexColor
number
rgb color
dst?
Color = null
ref out color
Returns
Color
lerp()
staticlerp(v,c1,c2,target?):Color
Defined in: src/math/Color.ts:348
lerp two color
Parameters
v
number
c1
Color
c2
Color
target?
Color
Returns
Color

