🎨 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?)
| Type | Name | Default | Description |
|---|---|---|---|
| number | R | 0 | Red color percentage (0-1) |
| number | G | X | Green color percentage (0-1) |
| number | B | X | Blue color percentage (0-1) |
| number | A | 1 | Alpha transparency percentage (0-1) |
🧽 Properties
| Type | Name | Description |
|---|---|---|
| number | R | Red color percentage (0-1) |
| number | G | Green color percentage (0-1) |
| number | B | Blue color percentage (0-1) |
| number | A | Alpha transparency percentage (0-1) |
🦠 Functions
info
This structure supports +, -, *, /, ==, and tostring operations.
ToHex
Gets the Hexadecimal representation of this Color
— Returns string (Hexadecimal representation of this Color).
local ret = my_color:ToHex(appends_transparency?)
| Type | Parameter | Default | Description |
|---|---|---|---|
| boolean | appends_transparency? | true | Appends transparency part |
🗼 Static Properties
| Value | Name |
|---|---|
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
| Returns | Name | Description | |
|---|---|---|---|
| Color | RandomPalette | Returns a random color from Color Palette | |
| Color | Random | Returns a random color from all color scope | |
| Color | FromRGBA | Returns the color from 0-255 range values | |
| Color | FromCYMK | Returns a color from the CYMK format | |
| Color | FromHSL | Returns a color from the HSL format | |
| Color | FromHSV | Returns a color from the HSV format | |
| Color | FromHEX | Returns 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?)
| Type | Parameter | Default | Description |
|---|---|---|---|
| boolean | includes_black? | true | Includes 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?)
FromCYMK
Returns a color from the CYMK format
— Returns Color (Final Color).
local ret = Color.FromCYMK(c?, y?, m?, k?, a?)
| Type | Parameter | Default | Description |
|---|---|---|---|
| number | c? | 0 | Cyan |
| number | y? | 0 | Yellow |
| number | m? | 0 | Magenta |
| number | k? | 0 | Black |
| number | a? | 0 | Alpha |
FromHSL
Returns a color from the HSL format
— Returns Color (Final Color).
local ret = Color.FromHSL(h?, s?, l?)
FromHSV
Returns a color from the HSV format
— Returns Color (Final Color).
local ret = Color.FromHSV(h?, s?, v?)
FromHEX
Returns a color from the Hexadecimal format
— Returns Color (Final Color).
local ret = Color.FromHEX(hex)
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | hex | Required parameter | Hexadecimal |