String
string.parse_hex
Shared
Converts a hexadecimal color string to RGB values
Syntax
local r, g, b = string.parse_hex(input)Parameters
| Type | Name | Description |
|---|---|---|
string | input | Hexadecimal color string - with or without # prefix |
Returns
| Type | Name | Description |
|---|---|---|
int | r | Red component (0-255) |
int | g | Green component (0-255) |
int | b | Blue component (0-255) |
Examples
--Parse hex color with # prefix
local r, g, b = string.parse_hex("#FF5733")
engine.print(r, g, b) --255 87 51--Parse hex color without # prefix
local r, g, b = string.parse_hex("00FF00")
engine.print(r, g, b) --0 255 0