util.string.parse_hex
Shared
Converts a hexadecimal color string to RGB values
Syntax
local r, g, b = util.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
local r, g, b = util.string.parse_hex("#FF5733")
core.engine.print("info", r, g, b) -- 255 87 51local r, g, b = util.string.parse_hex("00FF00")
core.engine.print("info", r, g, b) -- 0 255 0