Skip to main content
Version: 9.0.2

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

ParameterTypeDescription
r#numberThe red color field as a value from 0-255.
g#numberThe green color field as a value from 0-255.
b#numberThe 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)