Constructor
new module:Color(…colorDefinition)
Color constructor
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
colorDefinition | ColorDefinition | <repeatable> | Many types accepted (other Color instance, color name, hex string, hex number, red/green/blue/alpha value) |
- Source
Example
new Color("indigo"); // Any valid CSS color name
new Color("#123456"); // Hex string definition
new Color("#123"); // Hex shorthand string definition, #123 <=> #112233
new Color(0x123456); // Hex number definition
new Color(0.1, 0.2, 0.3); // Red, Green, Blue definition
Every definition can have one more optional parameter for alpha (opacity)
new Color("violet", 0.5);