Comment on page
🌈
color
color_object:clone():
color
Creates and returns a copy of the color object.
RGBA
HEX
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 | number | New R color range |
g | number | New G color range |
b | number | New B color range |
a | number | New A color range |
color_object:init(value: string):
color
📌 Available overloads (HEX
->RGBA
): color 'C8
' ->200
,200
,200
,255
color 'FF
A0
' ->255
,255
,255
,160
color 'FFC319
' ->255
,195
,25
,255
color 'AABBCCDD
' ->170
,187
,204
,221
Name | Type | Description |
---|---|---|
value | string | HEX string value (Format: AABBCCDD including all available overloads) |
Overwrites the color's ranges. Returns itself.
color_object:as_fraction(r: number, g: number, b: number, a: number):
color
Name | Type | Description |
---|---|---|
r | number | New R color range as a percentage in the range [0.0, 1.0] |
g | number | New G color range as a percentage in the range [0.0, 1.0] |
b | number | New B color range as a percentage in the range [0.0, 1.0] |
a | number | 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.
color_object:as_int32(value: number):
color
Name | Type | Description |
---|---|---|
value | number | int32 color value |
Overwrites the color's ranges converting the int32 value to RGBA values. Returns itself.
color_object:as_hsv(h: number, s: number, v: number, a: number):
color
Name | Type | Description |
---|---|---|
h | number | Hue color range [0.0, 1.0] |
s | number | Saturation color range [0.0, 1.0] |
v | number | Value color range [0.0, 1.0] |
a | number | Alpha color range [0.0, 1.0] |
Overwrites the color's ranges converting the HSV to RGBA values. Returns itself.
color_object:as_hsl(h: number, s: number, l: number, a: number):
color
Name | Type | Description |
---|---|---|
h | number | Hue color range [0.0, 1.0] |
s | number | Saturation color range [0.0, 1.0] |
l | number | Lightness color range [0.0, 1.0] |
a | number | Alpha color range [0.0, 1.0] |
Overwrites the color's ranges converting the HSL to RGBA values. Returns itself.
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].
color_object:to_hex():
string
Returns the HEX string representing the color.
color_object:to_int32():
number
Returns the int32 value representing the color.
color_object:to_hsv():
number
, number
, number
Returns the HSV representation of the color.
color_object:to_hsl():
number
, number
, number
Returns the HSL representation of the color.
color_object:lerp(other: color, weight: number):
color
Name | Type | Description |
---|---|---|
other | color | The color to interpolate to |
weight | number | A value between 0 and 1 that indicates the weight of other |
Returns the linearly interpolated color between two colors by the specified weight.
color_object:grayscale([ weight: number ]):
color
Name | Type | Description |
---|---|---|
weight | number | Optional. A value between 0 and 1 that indicates the weight of grayscale |
Returns the grayscaled color.
color_object:alpha_modulate(alpha: number):
color
Name | Type | Description |
---|---|---|
alpha | number | Alpha color range [0, 255] |
Returns the current color with an overridden Alpha color range.
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 modified 1yr ago