natiny.color.from_rgba

Lua
natiny.color.from_rgba(r, g, b, a) -> color

Returns an RGBA color packed into a Lua number.

Parameters

Name Type Description
r number Red channel, from 0.0 to 1.0
g number Green channel, from 0.0 to 1.0
b number Blue channel, from 0.0 to 1.0
a number Alpha channel, from 0.0 to 1.0

Returns

Type Description
number Packed 32-bit color in 0xRRGGBBAA layout, accepted by APIs whose color parameter is NatinyColor

Example

Lua
local orange = natiny.color.from_rgba(1.0, 0.55, 0.15, 1.0)
natiny.render.set_color(orange)

Notes

  • Components are clamped to 0.0 through 1.0 and quantized to 8 bits.