Skip to content

Class: Color

RGBA Color Object

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Color(r?, g?, b?, a?)

create new color instance

Parameters

NameTypeDefault valueDescription
rnumber1.0red channel
gnumber1.0green channel
bnumber1.0blue channel
anumber1.0alpha channel

Defined in

src/math/Color.ts:92

Properties

COLOR_RED

Static COLOR_RED: Color

red color

Defined in

src/math/Color.ts:10


COLOR_GREEN

Static COLOR_GREEN: Color

green color

Defined in

src/math/Color.ts:15


COLOR_BLUE

Static COLOR_BLUE: Color

blue color

Defined in

src/math/Color.ts:20


COLOR_WHITE

Static COLOR_WHITE: Color

white color

Defined in

src/math/Color.ts:25


r

r: number = 0

red channel

Defined in

src/math/Color.ts:68


g

g: number = 0

green channel

Defined in

src/math/Color.ts:73


b

b: number = 0

blue channel

Defined in

src/math/Color.ts:78


a

a: number = 0

alpha channel

Defined in

src/math/Color.ts:83


PRIMARY

Static PRIMARY: number = 0x3f51b5

Defined in

src/math/Color.ts:312


PRIMARYDARK

Static PRIMARYDARK: number = 0x303f9f

Defined in

src/math/Color.ts:313


ACCENT

Static ACCENT: number = 0xff4081

Defined in

src/math/Color.ts:314


WHITE

Static WHITE: number = 0xffffff

Defined in

src/math/Color.ts:316


IVORY

Static IVORY: number = 0xfffff0

Defined in

src/math/Color.ts:317


LIGHTYELLOW

Static LIGHTYELLOW: number = 0xffffe0

Defined in

src/math/Color.ts:318


YELLOW

Static YELLOW: number = 0xffff00

Defined in

src/math/Color.ts:319


SNOW

Static SNOW: number = 0xfffafa

Defined in

src/math/Color.ts:320


FLORALWHITE

Static FLORALWHITE: number = 0xfffaf0

Defined in

src/math/Color.ts:321


LEMONCHIFFON

Static LEMONCHIFFON: number = 0xfffacd

Defined in

src/math/Color.ts:322


CORNSILK

Static CORNSILK: number = 0xfff8dc

Defined in

src/math/Color.ts:323


SEASHELL

Static SEASHELL: number = 0xfff5ee

Defined in

src/math/Color.ts:324


LAVENDERBLUSH

Static LAVENDERBLUSH: number = 0xfff0f5

Defined in

src/math/Color.ts:325


PAPAYAWHIP

Static PAPAYAWHIP: number = 0xffefd5

Defined in

src/math/Color.ts:326


BLANCHEDALMOND

Static BLANCHEDALMOND: number = 0xffebcd

Defined in

src/math/Color.ts:327


MISTYROSE

Static MISTYROSE: number = 0xffe4e1

Defined in

src/math/Color.ts:328


BISQUE

Static BISQUE: number = 0xffe4c4

Defined in

src/math/Color.ts:329


MOCCASIN

Static MOCCASIN: number = 0xffe4b5

Defined in

src/math/Color.ts:330


Static NAVAJOWHITE: number = 0xffdead

Defined in

src/math/Color.ts:331


PEACHPUFF

Static PEACHPUFF: number = 0xffdab9

Defined in

src/math/Color.ts:332


GOLD

Static GOLD: number = 0xffd700

Defined in

src/math/Color.ts:333


PINK

Static PINK: number = 0xffc0cb

Defined in

src/math/Color.ts:334


LIGHTPINK

Static LIGHTPINK: number = 0xffb6c1

Defined in

src/math/Color.ts:335


ORANGE

Static ORANGE: number = 0xffa500

Defined in

src/math/Color.ts:336


LIGHTSALMON

Static LIGHTSALMON: number = 0xffa07a

Defined in

src/math/Color.ts:337


DARKORANGE

Static DARKORANGE: number = 0xff8c00

Defined in

src/math/Color.ts:338


CORAL

Static CORAL: number = 0xff7f50

Defined in

src/math/Color.ts:339


HOTPINK

Static HOTPINK: number = 0xff69b4

Defined in

src/math/Color.ts:340


TOMATO

Static TOMATO: number = 0xff6347

Defined in

src/math/Color.ts:341


ORANGERED

Static ORANGERED: number = 0xff4500

Defined in

src/math/Color.ts:342


DEEPPINK

Static DEEPPINK: number = 0xff1493

Defined in

src/math/Color.ts:343


FUCHSIA

Static FUCHSIA: number = 0xff00ff

Defined in

src/math/Color.ts:344


MAGENTA

Static MAGENTA: number = 0xff00ff

Defined in

src/math/Color.ts:345


RED

Static RED: number = 0xff0000

Defined in

src/math/Color.ts:346


OLDLACE

Static OLDLACE: number = 0xfdf5e6

Defined in

src/math/Color.ts:347


LIGHTGOLDENRODYELLOW

Static LIGHTGOLDENRODYELLOW: number = 0xfafad2

Defined in

src/math/Color.ts:348


LINEN

Static LINEN: number = 0xfaf0e6

Defined in

src/math/Color.ts:349


ANTIQUEWHITE

Static ANTIQUEWHITE: number = 0xfaebd7

Defined in

src/math/Color.ts:350


SALMON

Static SALMON: number = 0xfa8072

Defined in

src/math/Color.ts:351


GHOSTWHITE

Static GHOSTWHITE: number = 0xf8f8ff

Defined in

src/math/Color.ts:352


MINTCREAM

Static MINTCREAM: number = 0xf5fffa

Defined in

src/math/Color.ts:353


WHITESMOKE

Static WHITESMOKE: number = 0xf5f5f5

Defined in

src/math/Color.ts:354


BEIGE

Static BEIGE: number = 0xf5f5dc

Defined in

src/math/Color.ts:355


WHEAT

Static WHEAT: number = 0xf5deb3

Defined in

src/math/Color.ts:356


SANDYBROWN

Static SANDYBROWN: number = 0xf4a460

Defined in

src/math/Color.ts:357


AZURE

Static AZURE: number = 0xf0ffff

Defined in

src/math/Color.ts:358


HONEYDEW

Static HONEYDEW: number = 0xf0fff0

Defined in

src/math/Color.ts:359


ALICEBLUE

Static ALICEBLUE: number = 0xf0f8ff

Defined in

src/math/Color.ts:360


KHAKI

Static KHAKI: number = 0xf0e68c

Defined in

src/math/Color.ts:361


LIGHTCORAL

Static LIGHTCORAL: number = 0xf08080

Defined in

src/math/Color.ts:362


PALEGOLDENROD

Static PALEGOLDENROD: number = 0xeee8aa

Defined in

src/math/Color.ts:363


VIOLET

Static VIOLET: number = 0xee82ee

Defined in

src/math/Color.ts:364


DARKSALMON

Static DARKSALMON: number = 0xe9967a

Defined in

src/math/Color.ts:365


LAVENDER

Static LAVENDER: number = 0xe6e6fa

Defined in

src/math/Color.ts:366


LIGHTCYAN

Static LIGHTCYAN: number = 0xe0ffff

Defined in

src/math/Color.ts:367


BURLYWOOD

Static BURLYWOOD: number = 0xdeb887

Defined in

src/math/Color.ts:368


PLUM

Static PLUM: number = 0xdda0dd

Defined in

src/math/Color.ts:369


GAINSBORO

Static GAINSBORO: number = 0xdcdcdc

Defined in

src/math/Color.ts:370


CRIMSON

Static CRIMSON: number = 0xdc143c

Defined in

src/math/Color.ts:371


PALEVIOLETRED

Static PALEVIOLETRED: number = 0xdb7093

Defined in

src/math/Color.ts:372


GOLDENROD

Static GOLDENROD: number = 0xdaa520

Defined in

src/math/Color.ts:374


ORCHID

Static ORCHID: number = 0xda70d6

Defined in

src/math/Color.ts:375


THISTLE

Static THISTLE: number = 0xd8bfd8

Defined in

src/math/Color.ts:376


LIGHTGREY

Static LIGHTGREY: number = 0xd3d3d3

Defined in

src/math/Color.ts:377


TAN

Static TAN: number = 0xd2b48c

Defined in

src/math/Color.ts:378


CHOCOLATE

Static CHOCOLATE: number = 0xd2691e

Defined in

src/math/Color.ts:379


PERU

Static PERU: number = 0xcd853f

Defined in

src/math/Color.ts:380


INDIANRED

Static INDIANRED: number = 0xcd5c5c

Defined in

src/math/Color.ts:381


MEDIUMVIOLETRED

Static MEDIUMVIOLETRED: number = 0xc71585

Defined in

src/math/Color.ts:382


SILVER

Static SILVER: number = 0xc0c0c0

Defined in

src/math/Color.ts:383


DARKKHAKI

Static DARKKHAKI: number = 0xbdb76b

Defined in

src/math/Color.ts:384


ROSYBROWN

Static ROSYBROWN: number = 0xbc8f8f

Defined in

src/math/Color.ts:385


MEDIUMORCHID

Static MEDIUMORCHID: number = 0xba55d3

Defined in

src/math/Color.ts:386


DARKGOLDENROD

Static DARKGOLDENROD: number = 0xb8860b

Defined in

src/math/Color.ts:387


FIREBRICK

Static FIREBRICK: number = 0xb22222

Defined in

src/math/Color.ts:388


POWDERBLUE

Static POWDERBLUE: number = 0xb0e0e6

Defined in

src/math/Color.ts:389


LIGHTSTEELBLUE

Static LIGHTSTEELBLUE: number = 0xb0c4de

Defined in

src/math/Color.ts:390


PALETURQUOISE

Static PALETURQUOISE: number = 0xafeeee

Defined in

src/math/Color.ts:391


GREENYELLOW

Static GREENYELLOW: number = 0xadff2f

Defined in

src/math/Color.ts:392


LIGHTBLUE

Static LIGHTBLUE: number = 0xadd8e6

Defined in

src/math/Color.ts:393


DARKGRAY

Static DARKGRAY: number = 0xa9a9a9

Defined in

src/math/Color.ts:394


BROWN

Static BROWN: number = 0xa52a2a

Defined in

src/math/Color.ts:395


SIENNA

Static SIENNA: number = 0xa0522d

Defined in

src/math/Color.ts:396


DARKORCHID

Static DARKORCHID: number = 0x9932cc

Defined in

src/math/Color.ts:397


PALEGREEN

Static PALEGREEN: number = 0x98fb98

Defined in

src/math/Color.ts:398


DARKVIOLET

Static DARKVIOLET: number = 0x9400d3

Defined in

src/math/Color.ts:399


MEDIUMPURPLE

Static MEDIUMPURPLE: number = 0x9370db

Defined in

src/math/Color.ts:400


LIGHTGREEN

Static LIGHTGREEN: number = 0x90ee90

Defined in

src/math/Color.ts:401


DARKSEAGREEN

Static DARKSEAGREEN: number = 0x8fbc8f

Defined in

src/math/Color.ts:402


SADDLEBROWN

Static SADDLEBROWN: number = 0x8b4513

Defined in

src/math/Color.ts:403


DARKMAGENTA

Static DARKMAGENTA: number = 0x8b008b

Defined in

src/math/Color.ts:404


DARKRED

Static DARKRED: number = 0x8b0000

Defined in

src/math/Color.ts:405


BLUEVIOLET

Static BLUEVIOLET: number = 0x8a2be2

Defined in

src/math/Color.ts:406


LIGHTSKYBLUE

Static LIGHTSKYBLUE: number = 0x87cefa

Defined in

src/math/Color.ts:407


SKYBLUE

Static SKYBLUE: number = 0x87ceeb

Defined in

src/math/Color.ts:408


GRAY

Static GRAY: number = 0x808080

Defined in

src/math/Color.ts:409


OLIVE

Static OLIVE: number = 0x808000

Defined in

src/math/Color.ts:410


PURPLE

Static PURPLE: number = 0x800080

Defined in

src/math/Color.ts:411


MAROON

Static MAROON: number = 0x800000

Defined in

src/math/Color.ts:412


AQUAMARINE

Static AQUAMARINE: number = 0x7fffd4

Defined in

src/math/Color.ts:413


CHARTREUSE

Static CHARTREUSE: number = 0x7fff00

Defined in

src/math/Color.ts:414


LAWNGREEN

Static LAWNGREEN: number = 0x7cfc00

Defined in

src/math/Color.ts:415


MEDIUMSLATEBLUE

Static MEDIUMSLATEBLUE: number = 0x7b68ee

Defined in

src/math/Color.ts:416


LIGHTSLATEGRAY

Static LIGHTSLATEGRAY: number = 0x778899

Defined in

src/math/Color.ts:417


SLATEGRAY

Static SLATEGRAY: number = 0x708090

Defined in

src/math/Color.ts:418


OLIVEDRAB

Static OLIVEDRAB: number = 0x6b8e23

Defined in

src/math/Color.ts:419


SLATEBLUE

Static SLATEBLUE: number = 0x6a5acd

Defined in

src/math/Color.ts:420


DIMGRAY

Static DIMGRAY: number = 0x696969

Defined in

src/math/Color.ts:421


MEDIUMAQUAMARINE

Static MEDIUMAQUAMARINE: number = 0x66cdaa

Defined in

src/math/Color.ts:422


CORNFLOWERBLUE

Static CORNFLOWERBLUE: number = 0x6495ed

Defined in

src/math/Color.ts:423


CADETBLUE

Static CADETBLUE: number = 0x5f9ea0

Defined in

src/math/Color.ts:424


DARKOLIVEGREEN

Static DARKOLIVEGREEN: number = 0x556b2f

Defined in

src/math/Color.ts:425


INDIGO

Static INDIGO: number = 0x4b0082

Defined in

src/math/Color.ts:426


MEDIUMTURQUOISE

Static MEDIUMTURQUOISE: number = 0x48d1cc

Defined in

src/math/Color.ts:427


DARKSLATEBLUE

Static DARKSLATEBLUE: number = 0x483d8b

Defined in

src/math/Color.ts:428


STEELBLUE

Static STEELBLUE: number = 0x4682b4

Defined in

src/math/Color.ts:429


ROYALBLUE

Static ROYALBLUE: number = 0x4169e1

Defined in

src/math/Color.ts:430


TURQUOISE

Static TURQUOISE: number = 0x40e0d0

Defined in

src/math/Color.ts:431


MEDIUMSEAGREEN

Static MEDIUMSEAGREEN: number = 0x3cb371

Defined in

src/math/Color.ts:432


LIMEGREEN

Static LIMEGREEN: number = 0x32cd32

Defined in

src/math/Color.ts:433


DARKSLATEGRAY

Static DARKSLATEGRAY: number = 0x2f4f4f

Defined in

src/math/Color.ts:434


SEAGREEN

Static SEAGREEN: number = 0x2e8b57

Defined in

src/math/Color.ts:435


FORESTGREEN

Static FORESTGREEN: number = 0x228b22

Defined in

src/math/Color.ts:436


LIGHTSEAGREEN

Static LIGHTSEAGREEN: number = 0x20b2aa

Defined in

src/math/Color.ts:437


DODGERBLUE

Static DODGERBLUE: number = 0x1e90ff

Defined in

src/math/Color.ts:438


MIDNIGHTBLUE

Static MIDNIGHTBLUE: number = 0x191970

Defined in

src/math/Color.ts:439


AQUA

Static AQUA: number = 0x00ffff

Defined in

src/math/Color.ts:440


CYAN

Static CYAN: number = 0x00ffff

Defined in

src/math/Color.ts:441


SPRINGGREEN

Static SPRINGGREEN: number = 0x00ff7f

Defined in

src/math/Color.ts:442


LIME

Static LIME: number = 0x00ff00

Defined in

src/math/Color.ts:443


MEDIUMSPRINGGREEN

Static MEDIUMSPRINGGREEN: number = 0x00fa9a

Defined in

src/math/Color.ts:444


DARKTURQUOISE

Static DARKTURQUOISE: number = 0x00ced1

Defined in

src/math/Color.ts:445


DEEPSKYBLUE

Static DEEPSKYBLUE: number = 0x00bfff

Defined in

src/math/Color.ts:446


DARKCYAN

Static DARKCYAN: number = 0x008b8b

Defined in

src/math/Color.ts:447


TEAL

Static TEAL: number = 0x008080

Defined in

src/math/Color.ts:448


GREEN

Static GREEN: number = 0x008000

Defined in

src/math/Color.ts:449


DARKGREEN

Static DARKGREEN: number = 0x006400

Defined in

src/math/Color.ts:450


BLUE

Static BLUE: number = 0x0000ff

Defined in

src/math/Color.ts:451


MEDIUMBLUE

Static MEDIUMBLUE: number = 0x0000cd

Defined in

src/math/Color.ts:452


DARKBLUE

Static DARKBLUE: number = 0x00008b

Defined in

src/math/Color.ts:453


Static NAVY: number = 0x000080

Defined in

src/math/Color.ts:454


BLACK

Static BLACK: number = 0x000000

Defined in

src/math/Color.ts:455

Accessors

rgb

get rgb(): number[]

get rgb to array

Returns

number[]

Defined in

src/math/Color.ts:226

set rgb(c): void

set rgb by array

Parameters

NameType
cnumber[]

Returns

void

Defined in

src/math/Color.ts:233


rgba

get rgba(): number[]

get rgba to array

Returns

number[]

Defined in

src/math/Color.ts:240

set rgba(c): void

set rgb by array

Parameters

NameType
cnumber[]

Returns

void

Defined in

src/math/Color.ts:247

Methods

convertToHDRRGB

convertToHDRRGB(): Color

convert to hdr color , channel a is intensity

Returns

Color

Defined in

src/math/Color.ts:99


unSerialized

unSerialized(data): Color

unSerialized color by data

Parameters

NameType
dataany

Returns

Color

Defined in

src/math/Color.ts:111


hexToRGB

hexToRGB(value): Color

update this color rgb from hexadecimal no alpha

Parameters

NameType
valuenumber

Returns

Color

Defined in

src/math/Color.ts:123


hexToRGBA

hexToRGBA(value): Color

update this color rgb from hexadecimal has alpha

Parameters

NameType
valuenumber

Returns

Color

Defined in

src/math/Color.ts:135


random

Static random(base?): Color

random on color

Parameters

NameTypeDefault value
basenumber1.0

Returns

Color

Defined in

src/math/Color.ts:147


setTo

setTo(r, g, b, a): void

set rgba to this color

Parameters

NameTypeDescription
rnumberred channel
gnumbergreen channel
bnumberblue channel
anumberalpha channel

Returns

void

Defined in

src/math/Color.ts:163


setHex

setHex(hex): void

update this color rgba from hexadecimal

Parameters

NameTypeDescription
hexstringhex string.

Returns

void

Defined in

src/math/Color.ts:174


getHex

getHex(): string

convert this color to hex string code

Returns

string

Defined in

src/math/Color.ts:210


clone

clone(): Color

clone this color

Returns

Color

Defined in

src/math/Color.ts:255


copyFrom

copyFrom(src): Color

copy color from source color

Parameters

NameType
srcColor

Returns

Color

Defined in

src/math/Color.ts:263


copyFromArray

copyFromArray(arr, scalar?): Color

copy color from array

Parameters

NameTypeDefault valueDescription
arrnumber[]undefined[ 255 , 255 , 255 , 255 ]
scalarnumber255

Returns

Color

Defined in

src/math/Color.ts:277


copyFromVector

copyFromVector(value): Color

copy color from vector3 or vector4

Parameters

NameTypeDescription
valueObject{ x: number, y: number, z: number, w?: number }
value.xnumber-
value.ynumber-
value.znumber-
value.w?number-

Returns

Color

Defined in

src/math/Color.ts:291


hexRGBColor

Static hexRGBColor(hexColor, dst?): Color

update this color rgb from hexadecimal no alpha

Parameters

NameTypeDefault valueDescription
hexColornumberundefinedrgb color
dstColornullref out color

Returns

Color

Defined in

src/math/Color.ts:304