gre.rgb
gre.rgb(
r,
g,
b,
[a]
)
Create a color number value from the individual red, green and blue color components. An optional fourth argument, alpha, may be provided.
Parameters
| Parameter | Type | Description |
|---|---|---|
r | #number | The red color field as a value from 0-255. |
g | #number | The green color field as a value from 0-255. |
b | #number | The blue color field as a value from 0-255. |
a | #number | [Optional] alpha value from 0-255. |
Returns
A number value that represents the combined red, green, blue and alpha values.
Example
-- Create a grey single color value
local grey = gre.rgb(100, 100, 100)
-- Extract the red, green and blue values from the grey
local r, g, b = gre.torgb(grey)