natiny.color.from_hex

Lua
natiny.color.from_hex(hex) -> color

Parses a hexadecimal color and returns it as a packed Lua number.

Parameters

Name Type Description
hex string RGB, RGBA, RRGGBB, or RRGGBBAA, with an optional leading #

Returns

Type Description
number Packed color accepted by APIs whose color parameter is NatinyColor; 0 if the string is invalid

Example

Lua
local orange = natiny.color.from_hex("#ff8c26")
natiny.render.set_color(orange)