natiny_color_from_hex

C
NatinyColor natiny_color_from_hex(const char* hex);

Parses a hexadecimal color and returns it as a packed NatinyColor.

Parameters

Name Type Description
hex const char* Null-terminated RGB, RGBA, RRGGBB, or RRGGBBAA text, with an optional leading #

Returns

Type Description
NatinyColor Packed color in 0xRRGGBBAA layout; 0 if hex is NULL or invalid

Example

C
NatinyColor orange = natiny_color_from_hex("#ff8c26");
natiny_render_set_color(orange);