Skip to main content
Version: latest - a1.73.x βš–οΈ

🎨 Color

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

πŸ‘Open Source
This library implementation is Open Sourced on GitHub!
πŸ§‘β€πŸ’»API Source
This page is auto-generated! The Functions, Properties and Events described here are defined in our GitHub's API Repository! Feel free to commit suggestions and changes to the source .json API files!

πŸŽ’ 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?)
TypeNameDefaultDescription
R0Red color percentage (0-1)
GXGreen color percentage (0-1)
BXBlue color percentage (0-1)
A1Alpha transparency percentage (0-1)

🧽 Properties​

TypeNameDescription
RRed color percentage (0-1)
GGreen color percentage (0-1)
BBlue color percentage (0-1)
AAlpha transparency percentage (0-1)

🦠 Functions​

info

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

ReturnsNameDescription
Gets the Hexadecimal representation of this Color

ToHex

Gets the Hexadecimal representation of this Color

β€” Returns (Hexadecimal representation of this Color).

local ret = my_color:ToHex(appends_transparency?)
TypeParameterDefaultDescription
appends_transparency?trueAppends transparency part

πŸ—Ό 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
ColorReturns a random color from Color Palette
ColorReturns a random color from all color scope
ColorReturns the color from 0-255 range values
ColorReturns a color from the CYMK format
ColorReturns a color from the HSL format
ColorReturns a color from the HSV format
ColorReturns a color from the Hexadecimal format

RandomPalette

Returns a random color from Color Palette

β€” Returns Color (Random color from Color Palette).

local ret = Color.RandomPalette(includes_black?)
TypeParameterDefaultDescription
includes_black?trueIncludes blacks in the scope

Random

Returns a random color from all color scope

β€” Returns Color (Random color from all color scope).

local ret = Color.Random()

FromRGBA

Returns the color from 0-255 range values

β€” Returns Color (Final Color).

local ret = Color.FromRGBA(r?, g?, b?, a?)
TypeParameterDefaultDescription
r?0Red
g?0Green
b?0Blue
a?0Alpha

FromCYMK

Returns a color from the CYMK format

β€” Returns Color (Final Color).

local ret = Color.FromCYMK(c?, y?, m?, k?, a?)
TypeParameterDefaultDescription
c?0Cyan
y?0Yellow
m?0Magenta
k?0Black
a?0Alpha

FromHSL

Returns a color from the HSL format

β€” Returns Color (Final Color).

local ret = Color.FromHSL(h?, s?, l?)
TypeParameterDefaultDescription
h?0Hue
s?0Saturation
l?0Lightness

FromHSV

Returns a color from the HSV format

β€” Returns Color (Final Color).

local ret = Color.FromHSV(h?, s?, v?)
TypeParameterDefaultDescription
h?0Hue
s?0Saturation
v?0Value

FromHEX

Returns a color from the Hexadecimal format

β€” Returns Color (Final Color).

local ret = Color.FromHEX(hex)
TypeParameterDefaultDescription
hex Required parameter Hexadecimal