Ir para o conteúdo principal
Version: bleeding-edge 🩸

🎨 Color

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

🧑‍💻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

local my_color = Color(R?, G?, B?, A?)
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

— Returns string (Hexadecimal representation of this Color).

local ret = my_color:ToHex(appends_transparency?)
TypeParameterDefaultDescription
booleanappends_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
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

— Returns Color (Random color from Color Palette).

local ret = Color.RandomPalette(includes_black?)
TypeParameterDefaultDescription
booleanincludes_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
numberr?0Red
numberg?0Green
numberb?0Blue
numbera?0Alpha

FromCYMK

Returns a color from the CYMK format

— Returns Color (Final Color).

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

FromHSL

Returns a color from the HSL format

— Returns Color (Final Color).

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

FromHSV

Returns a color from the HSV format

— Returns Color (Final Color).

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

FromHEX

Returns a color from the Hexadecimal format

— Returns Color (Final Color).

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