Constructor
new Color3(ropt, gopt, bopt)
Constructs a new three-component color.
Name | Type | Attributes | Description |
---|---|---|---|
r | number | <optional> | The red component of the color. If |
g | number | <optional> | The green component. |
b | number | <optional> | The blue component. |
Members
b :number
The blue component.
- number
- Default Value
- 0
g :number
The green component.
- number
- Default Value
- 0
r :number
The red component.
- number
- Default Value
- 0
Methods
clone() → {Color3}
Returns a new color with copied values from this instance.
A clone of this instance.
- Type:
- Color3
convertLinearToSRGB() → {Color3}
Converts this color from linear space to sRGB space.
A reference to this color.
- Type:
- Color3
convertSRGBToLinear() → {Color3}
Converts this color from sRGB space to linear space.
A reference to this color.
- Type:
- Color3
copy(color) → {Color3}
Copies the values of the given color to this instance.
Name | Type | Description |
---|---|---|
color | Color3 | The color to copy. |
A reference to this color.
- Type:
- Color3
fromArray(array, offsetopt, denormalizeopt) → {Color3}
Sets this color's RGB components from the given array.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
array | Array.<number> | An array holding the RGB values. | ||
offset | number | <optional> | 0 | The offset into the array. |
denormalize | boolean | <optional> | false | If true, denormalize the values, and array should be a typed array. |
A reference to this color.
- Type:
- Color3
getHex() → {number}
Returns the hexadecimal value of this color.
The hexadecimal value.
- Type:
- number
lerp(color, alpha) → {Color3}
Linearly interpolates this color's RGB values toward the RGB values of the given color. The alpha argument can be thought of as the ratio between the two colors, where 0.0 is this color and 1.0 is the first argument.
Name | Type | Description |
---|---|---|
color | Color3 | The color to converge on. |
alpha | number | The interpolation factor in the closed interval [0,1]. |
A reference to this color.
- Type:
- Color3
lerpColors(color1, color2, alpha) → {Color3}
Linearly interpolates between the given colors and stores the result in this instance. The alpha argument can be thought of as the ratio between the two colors, where 0.0 is the first and 1.0 is the second color.
Name | Type | Description |
---|---|---|
color1 | Color3 | The first color. |
color2 | Color3 | The second color. |
alpha | number | The interpolation factor in the closed interval [0,1]. |
A reference to this color.
- Type:
- Color3
setHSL(h, s, l) → {Color3}
Set this color from HSL values.
Name | Type | Description |
---|---|---|
h | number | Hue value between 0.0 and 1.0. |
s | number | Saturation value between 0.0 and 1.0. |
l | number | Lightness value between 0.0 and 1.0. |
A reference to this color.
- Type:
- Color3
setHex(hex) → {Color3}
Sets this color from a hexadecimal value.
Name | Type | Description |
---|---|---|
hex | number | The hexadecimal value. |
A reference to this color.
- Type:
- Color3
setRGB(r, g, b) → {Color3}
Sets this color from RGB values.
Name | Type | Description |
---|---|---|
r | number | Red channel value between 0.0 and 1.0. |
g | number | Green channel value between 0.0 and 1.0. |
b | number | Blue channel value between 0.0 and 1.0. |
A reference to this color.
- Type:
- Color3
toArray(arrayopt, offsetopt, normalizeopt) → {Array.<number>}
Writes the RGB components of this color to the given array. If no array is provided, the method returns a new instance.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
array | Array.<number> | <optional> | [] | The target array holding the color components. |
offset | number | <optional> | 0 | Index of the first element in the array. |
normalize | boolean | <optional> | false | If true, normalize the values, and array should be a typed array. |
The color components.
- Type:
- Array.<number>