đcolor
Example available!
âī¸ColorFunctions:
:clone
color_object:clone():
color
Creates and returns a copy of the color object.
:init
color_object:init(r: number, g: number, b: number, a: number):
color
đ Available overloads (
RGBA
): color() ->255
,255
,255
,255
color(200
) ->200
,200
,200
,255
color(255
,160
) ->255
,255
,255
,160
color(255
,195
,25
) ->255
,195
,25
,255
color(255
,195
,25
,200
) ->255
,195
,25
,200
Name | Type | Description |
---|---|---|
r |
| New R color range |
g |
| New G color range |
b |
| New B color range |
a |
| New A color range |
Overwrites the color's ranges. Returns itself.
:as_fraction
color_object:as_fraction(r: number, g: number, b: number, a: number):
color
Name | Type | Description |
---|---|---|
r |
| New R color range as a percentage in the range [0.0, 1.0] |
g |
| New G color range as a percentage in the range [0.0, 1.0] |
b |
| New B color range as a percentage in the range [0.0, 1.0] |
a |
| New A color range as a percentage in the range [0.0, 1.0] |
Overwrites the color's ranges using the fraction values. Returns itself.
:as_int32
color_object:as_int32(value: number):
color
Name | Type | Description |
---|---|---|
value |
| int32 color value |
Overwrites the color's ranges converting the int32 value to RGBA values. Returns itself.
:as_hsv
color_object:as_hsv(h: number, s: number, v: number, a: number):
color
Name | Type | Description |
---|---|---|
h |
| Hue color range [0.0, 1.0] |
s |
| Saturation color range [0.0, 1.0] |
v |
| Value color range [0.0, 1.0] |
a |
| Alpha color range [0.0, 1.0] |
Overwrites the color's ranges converting the HSV to RGBA values. Returns itself.
:as_hsl
color_object:as_hsl(h: number, s: number, l: number, a: number):
color
Name | Type | Description |
---|---|---|
h |
| Hue color range [0.0, 1.0] |
s |
| Saturation color range [0.0, 1.0] |
l |
| Lightness color range [0.0, 1.0] |
a |
| Alpha color range [0.0, 1.0] |
Overwrites the color's ranges converting the HSL to RGBA values. Returns itself.
:to_fraction
color_object:to_fraction():
number
, number
, number
, number
Returns the r, g, b, and a ranges of the color as a percentage in the range of [0.0, 1.0].
:to_hex
color_object:to_hex():
string
Returns the HEX string representing the color.
:to_int32
color_object:to_int32():
number
Returns the int32 value representing the color.
:to_hsv
color_object:to_hsv():
number
, number
, number
Returns the HSV representation of the color.
:to_hsl
color_object:to_hsl():
number
, number
, number
Returns the HSL representation of the color.
:lerp
color_object:lerp(other: color, weight: number):
color
Name | Type | Description |
---|---|---|
other |
| The color to interpolate to |
weight |
| A value between 0 and 1 that indicates the weight of other |
Returns the linearly interpolated color between two colors by the specified weight.
:grayscale
color_object:grayscale([ weight: number ]):
color
Name | Type | Description |
---|---|---|
weight |
| Optional. A value between 0 and 1 that indicates the weight of grayscale |
Returns the grayscaled color.
:alpha_modulate
color_object:alpha_modulate(alpha: number):
color
Name | Type | Description |
---|---|---|
alpha |
| Alpha color range [0, 255] |
Returns the current color with an overridden Alpha color range.
:unpack
color_object:unpack():
number
, number
, number
, number
Returns the r, g, b, and a values of the color. Note that these fields can be accessed by indexing r, g, b, and a.
Last updated