🎨 Color
A color composed of components (R, G, B, A) with floating point precision
🎒 Examples
local grey_color = Color(0.5, 0.5, 0.5, 1)
🛠 Constructors
🧽 Properties
| Type | Name | Description |
|---|---|---|
| float | R | Red color percentage (0-1) |
| float | G | Green color percentage (0-1) |
| float | B | Blue color percentage (0-1) |
| float | A | Alpha transparency percentage (0-1) |
🦠 Functions
info
This structure supports +, -, *, /, ==, and tostring operations.
ToHexOptimal
Gets the Hexadecimal representation of this Color
local ret = my_color:ToHex(appends_transparency?)
Parameters
| Name | Type | Description |
|---|---|---|
appends_transparency? | boolean | Appends transparency part Default true |
Returns
| Type | Description |
|---|---|
| string | Hexadecimal representation of this Color |
🗼 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
RandomPalette: Color | Returns a random color from Color Palette | |
Random: Color | Returns a random color from all color scope | |
FromRGBA: Color | Returns the color from 0-255 range values | |
FromCYMK: Color | Returns a color from the CYMK format | |
FromHSL: Color | Returns a color from the HSL format | |
FromHSV: Color | Returns a color from the HSV format | |
FromHEX: Color | Returns a color from the Hexadecimal format |
RandomPaletteOptimal
Returns a random color from Color Palette
local ret = Color.RandomPalette(includes_black?)
Parameters
| Name | Type | Description |
|---|---|---|
includes_black? | boolean | Includes blacks in the scope Default true |
Returns
| Type | Description |
|---|---|
| Color | Random color from Color Palette |
RandomOptimal
Returns a random color from all color scope
local ret = Color.Random()
Returns
| Type | Description |
|---|---|
| Color | Random color from all color scope |
FromRGBAOptimal
Returns the color from 0-255 range values
local ret = Color.FromRGBA(r?, g?, b?, a?)
Parameters
| Name | Type | Description |
|---|---|---|
r? | float | Red Default 0 |
g? | float | Green Default 0 |
b? | float | Blue Default 0 |
a? | float | Alpha Default 0 |
Returns
| Type | Description |
|---|---|
| Color | Final Color |
FromCYMKOptimal
Returns a color from the CYMK format
local ret = Color.FromCYMK(c?, y?, m?, k?, a?)
Parameters
| Name | Type | Description |
|---|---|---|
c? | float | Cyan Default 0 |
y? | float | Yellow Default 0 |
m? | float | Magenta Default 0 |
k? | float | Black Default 0 |
a? | float | Alpha Default 0 |
Returns
| Type | Description |
|---|---|
| Color | Final Color |
FromHSLOptimal
Returns a color from the HSL format
local ret = Color.FromHSL(h?, s?, l?)
Parameters
| Name | Type | Description |
|---|---|---|
h? | float | Hue Default 0 |
s? | float | Saturation Default 0 |
l? | float | Lightness Default 0 |
Returns
| Type | Description |
|---|---|
| Color | Final Color |
