Constructor
new Color(r, g, b, a)
- Source:
Properties:
Name | Type | Description |
---|---|---|
components |
Float32Array | A typed array storing the components of this color (rgba). |
Creates an instance of Color.
Parameters:
Name | Type | Description |
---|---|---|
r |
Number | The red component (0.0 - 1.0). |
g |
Number | The green component (0.0 - 1.0). |
b |
Number | The blue component (0.0 - 1.0). |
a |
Number | The alpha component (0.0 - 1.0). |
Methods
(static) fromHex(hex) → {Lore.Color}
- Source:
Set the r,g,b,a components from a hex string.
Parameters:
Name | Type | Description |
---|---|---|
hex |
String | A hex string in the form of #ABCDEF or #ABC. |
Returns:
A color representing the hex string.
- Type
- Lore.Color
(static) gdbHueShift(hue) → {Number}
- Source:
Shifts the hue so that 0.0 represents blue and 1.0 represents magenta.
Parameters:
Name | Type | Description |
---|---|---|
hue |
Number | A hue component. |
Returns:
The hue component shifted so that 0.0 is blue and 1.0 is magenta.
- Type
- Number
(static) hslToRgb(h, s, l) → {Array.<Number>}
- Source:
Converts HSL to RGB.
Parameters:
Name | Type | Description |
---|---|---|
h |
Number | The hue component. |
s |
Number | The saturation component. |
l |
Number | The lightness component. |
Returns:
An array containing the r, g and b values ([r, g, b]).
- Type
- Array.<Number>
(static) hueToRgb(p, q, t) → {Number}
- Source:
Get the r, g or b value from a hue component.
Parameters:
Name | Type | Description |
---|---|---|
p |
Number | |
q |
Number | |
t |
Number |
Returns:
The r, g or b component value.
- Type
- Number
(static) rgbToHsl(r, g, b) → {Array.<Number>}
- Source:
Converts RGB to HSL.
Parameters:
Name | Type | Description |
---|---|---|
r |
Number | The red component. |
g |
Number | The green component. |
b |
Number | The blue component. |
Returns:
An array containing the h, s and l values ([h, s, l]).
- Type
- Array.<Number>
set(r, g, b, a) → {Lore.Color}
- Source:
Set the red, green, blue and alpha components of the color.
Parameters:
Name | Type | Description |
---|---|---|
r |
Number | The red component (0.0 - 1.0). |
g |
Number | The green component (0.0 - 1.0). |
b |
Number | The blue component (0.0 - 1.0). |
a |
Number | The alpha component (0.0 - 1.0). |
Returns:
Returns itself.
- Type
- Lore.Color