Skip to main content
Version: Next

hexStringToRgbObj

Using

Convert HEX color "#red as 16* green as 16* blue as 16*" as an string (16* - Hexagonal Calculus) to a RGB color {r: red, g: green, b: blue} as an object.

Demo - use JSON
hexStringToRgbObj(
)
{"r":20,"g":255,"b":179}

Arguments

ArgumentTypeDescriptionExample
strstring
function
HEX color string or function.#f80032

Returns

object — Returns RGB color in format {r: red, g: green, b: blue} as an string.

Examples

hexStringToRgbObj('#1200E3');
// { r: 18, g: 0, b: 227 }

hexStringToRgbObj(() => '#401563');
// { r: 64, g: 21, b: 99 }

hexStringToRgbObj(false);
// '#000000'

Resources

📦 Since:1.1.0
📦 Last updated:1.1.0
📦 Available in:1.3.0