Passer au contenu principal
Version: dernière - a1.19.x ⚖️

🎨 Color

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

👐Open Source
This structure is Open Sourced on GitHub. Feel free to make pull requests and suggest changes!

🎒 Examples

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

🏗️ Constructor

local my_color = Color(R?, G?, B?, A?)
TypeNameDefaultDescription
number R0Red color percentage (0-1)
number G0Green color percentage (0-1)
number B0Blue color percentage (0-1)
number A0Alpha transparency percentage (0-1)

🧽 Properties

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

🦠 Functions

info

Cette structure supporte les opérations +, -, *, /, ==, et tostring.

ReturnsNameDescription
string ToHexGets 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()

🗼 Propriétés Statiques

ValeurNom
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

🗿 Fonctions statiques

ReturnsNameDescription
Color RandomPaletteReturns a random color from Color Palette
Color RandomReturns a random color from all color scope
Color FromRGBAReturns the color from 0-255 range values
Color FromCYMKReturns a color from the CYMK format
Color FromHSLReturns a color from the HSL format
Color FromHSVReturns a color from the HSV format
Color FromHEXReturns 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
boolean 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
number r?0Red
number g?0Green
number b?0Blue
number a?0Alpha

FromCYMK

Returns a color from the CYMK format

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

FromHSL

Returns a color from the HSL format

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

FromHSV

Returns a color from the HSV format

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

FromHEX

Returns a color from the Hexadecimal format

Returns Color (Final Color)
local ret = Color.FromHEX(hex)
TypeParameterDefaultDescription
string hexHexadecimal