Skip to main content
Version: bleeding-edge 🩸

🎨 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?)

Parameters

TypeNameDefaultDescription
numberR0Red color percentage (0-1)
numberGXGreen color percentage (0-1)
numberBXBlue color percentage (0-1)
numberA1Alpha transparency percentage (0-1)

🧽 Properties

TypeNameDescription
numberRRed color percentage (0-1)
numberGGreen color percentage (0-1)
numberBBlue color percentage (0-1)
numberAAlpha transparency percentage (0-1)

🦠 Functions

info

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

ReturnsNameDescription
stringToHexGets the Hexadecimal representation of this Color

ToHex

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

Parameters

TypeParameterDefaultDescription
booleanappends_transparency?trueAppends 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

RandomPalette

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

Parameters

TypeParameterDefaultDescription
booleanincludes_black?trueIncludes blacks in the scope

Returns

TypeDescription
ColorRandom color from Color Palette

Random

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

Returns

TypeDescription
ColorRandom color from all color scope

FromRGBA

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

Parameters

TypeParameterDefaultDescription
numberr?0Red
numberg?0Green
numberb?0Blue
numbera?0Alpha

Returns

TypeDescription
ColorFinal Color

FromCYMK

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

Parameters

TypeParameterDefaultDescription
numberc?0Cyan
numbery?0Yellow
numberm?0Magenta
numberk?0Black
numbera?0Alpha

Returns

TypeDescription
ColorFinal Color

FromHSL

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

Parameters

TypeParameterDefaultDescription
numberh?0Hue
numbers?0Saturation
numberl?0Lightness

Returns

TypeDescription
ColorFinal Color

FromHSV

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

Parameters

TypeParameterDefaultDescription
numberh?0Hue
numbers?0Saturation
numberv?0Value

Returns

TypeDescription
ColorFinal Color

FromHEX

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

Parameters

TypeParameterDefaultDescription
stringhex Required parameter Hexadecimal

Returns

TypeDescription
ColorFinal Color