Skip to content

format

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

description

Create a color data with specified RGB and Alpha components.

parameter

param_nametypedescription
rnumber?The red component of the color (range from 0 to 1), default value is 1.
gnumber?The green component of the color (range from 0 to 1), default value is 1.
bnumber?The blue component of the color (range from 0 to 1), default value is 1.
anumber?The alpha component of the color (0 is transparent, 1 is opaque), default value is 1.

code example

javascript
let color0 = new Color();
let color1 = new Color(0.9);
let color2 = new Color(0.9, 0.8);
let color3 = new Color(0.9, 0.8, 0.7);
let color4 = new Color(0.9, 0.8, 0.7, 0.6);