Skip to main content
Version: latest - a1.156.0 ⚖️

🎨 Color

A color composed of components (R, G, B, A) with floating point precision.


🎒 Examples​

local grey_color = Color(0.5, 0.5, 0.5, 1)

🛠 Constructors​

Default Constructor​

No description provided

local my_color = Color(R?, G?, B?, A?)

Parameters

TypeNameDefaultDescription
floatR0Red color percentage (0-1)
floatGXGreen color percentage (0-1)
floatBXBlue color percentage (0-1)
floatA1Alpha transparency percentage (0-1)

🧽 Properties​

TypeNameDescription
floatRRed color percentage (0-1)
floatGGreen color percentage (0-1)
floatBBlue color percentage (0-1)
floatAAlpha transparency percentage (0-1)

🦠 Functions​

info

This structure supports +, -, *, /, ==, and tostring operations.

ReturnsNameDescription
stringToHexGets the Hexadecimal representation of this Color

Optimal

ToHex​

Gets the Hexadecimal representation of this Color
local ret = my_color:ToHex(appends_transparency?)

Parameters

TypeParameterDefaultDescription
booleanappends_transparency?true
Appends transparency part

Returns

TypeDescription
stringHexadecimal representation of this Color

🗼 Static Properties​

ValueName
Color(1, 1, 1)Color.WHITE
Color(0, 0, 0)Color.BLACK
Color(0, 0, 0, 0)Color.TRANSPARENT
Color(1, 0, 0)Color.RED
Color(0, 1, 0)Color.GREEN
Color(0, 0, 1)Color.BLUE
Color(1, 1, 0)Color.YELLOW
Color(0, 1, 1)Color.CYAN
Color(1, 0, 1)Color.MAGENTA
Color(1, 0.5, 0)Color.ORANGE
Color(0.5, 1, 1)Color.CHARTREUSE
Color(0, 1, 0.5)Color.AQUAMARINE
Color(0, 0.5, 1)Color.AZURE
Color(0.5, 0, 1)Color.VIOLET
Color(1, 0, 0.5)Color.ROSE

🗿 Static Functions​

ReturnsNameDescription
ColorRandomPaletteReturns a random color from Color Palette
ColorRandomReturns a random color from all color scope
ColorFromRGBAReturns the color from 0-255 range values
ColorFromCYMKReturns a color from the CYMK format
ColorFromHSLReturns a color from the HSL format
ColorFromHSVReturns a color from the HSV format
ColorFromHEXReturns a color from the Hexadecimal format

Optimal

RandomPalette​

Returns a random color from Color Palette
local ret = Color.RandomPalette(includes_black?)

Parameters

TypeParameterDefaultDescription
booleanincludes_black?true
Includes blacks in the scope

Returns

TypeDescription
ColorRandom color from Color Palette

Optimal

Random​

Returns a random color from all color scope
local ret = Color.Random()

Returns

TypeDescription
ColorRandom color from all color scope

Optimal

FromRGBA​

Returns the color from 0-255 range values
local ret = Color.FromRGBA(r?, g?, b?, a?)

Parameters

TypeParameterDefaultDescription
floatr?0
Red
floatg?0
Green
floatb?0
Blue
floata?0
Alpha

Returns

TypeDescription
ColorFinal Color

Optimal

FromCYMK​

Returns a color from the CYMK format
local ret = Color.FromCYMK(c?, y?, m?, k?, a?)

Parameters

TypeParameterDefaultDescription
floatc?0
Cyan
floaty?0
Yellow
floatm?0
Magenta
floatk?0
Black
floata?0
Alpha

Returns

TypeDescription
ColorFinal Color

Optimal

FromHSL​

Returns a color from the HSL format
local ret = Color.FromHSL(h?, s?, l?)

Parameters

TypeParameterDefaultDescription
floath?0
Hue
floats?0
Saturation
floatl?0
Lightness

Returns

TypeDescription
ColorFinal Color

Optimal

FromHSV​

Returns a color from the HSV format
local ret = Color.FromHSV(h?, s?, v?)

Parameters

TypeParameterDefaultDescription
floath?0
Hue
floats?0
Saturation
floatv?0
Value

Returns

TypeDescription
ColorFinal Color

Optimal

FromHEX​

Returns a color from the Hexadecimal format
local ret = Color.FromHEX(hex)

Parameters

TypeParameterDefaultDescription
stringhex Required parameter Hexadecimal

Returns

TypeDescription
ColorFinal Color