🎨Color
Color metatable
Fields
r
number
red
g
number
green
b
number
blue
a
number
alpha
r [?]
number
(default: 255)
g [?]
number
(default: 255)
b [?]
number
(default: 255)
a [?]
number
(default: 255)
Create a new Color.
Color(hex: string
): Color
string
): Color
hex
string
Hex string. Do not use "#" symbol.
Create a new Color from hex string.
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.
:AsInt(value: number
): Color
number
): Color
value
number
int color value
Overwrites the color's ranges converting the int value to RGBA values. Returns itself.
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.
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.
:ToFraction(): number
, number
, number
, number
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].
:ToInt(): number
number
Returns the int value representing the color.
:ToHsv(): number
, number
, number
number
, number
, number
Returns the HSV representation of the color.
:ToHsl(): number
, number
, number
number
, number
, number
Returns the ToHsl representation of the color.
:ToHex(): string
string
Returns the hex string representing the color.
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.
:Grayscale(weight: number
): Color
number
): Color
weight
number
A value between 0 and 1 that indicates the weight of grayscale
Returns the grayscaled color.
:AlphaModulate(alpha: number
): Color
number
): Color
alpha
number
Alpha color range [0.0, 1.0]
Returns the alpha modulated color.
:Clone(): Color
Color
Creates and returns a copy of the color object.
:Unpack(): number
, number
, number
, number
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.
:__tostring(): string
string
Returns hex string representing the color.
r [?]
number
(default: 255)
g [?]
number
(default: 255)
b [?]
number
(default: 255)
a [?]
number
(default: 255)
Create a new Color.
Color(hex: string
): Color
string
): Color
hex
string
Hex string. Do not use "#" symbol.
Create a new Color from hex string.
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.
:AsInt(value: number
): Color
number
): Color
value
number
int color value
Overwrites the color's ranges converting the int value to RGBA values. Returns itself.
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.
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.
:ToFraction(): number
, number
, number
, number
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].
:ToInt(): number
number
Returns the int value representing the color.
:ToHsv(): number
, number
, number
number
, number
, number
Returns the HSV representation of the color.
:ToHsl(): number
, number
, number
number
, number
, number
Returns the ToHsl representation of the color.
:ToHex(): string
string
Returns the hex string representing the color.
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.
:Grayscale(weight: number
): Color
number
): Color
weight
number
A value between 0 and 1 that indicates the weight of grayscale
Returns the grayscaled color.
:AlphaModulate(alpha: number
): Color
number
): Color
alpha
number
Alpha color range [0.0, 1.0]
Returns the alpha modulated color.
:Clone(): Color
Color
Creates and returns a copy of the color object.
:Unpack(): number
, number
, number
, number
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.
:__tostring(): string
string
Returns hex string representing the color.
Last updated