Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Convert Hexidecimal to RGB value(for colors)
let HEX_to_RGB = (hex) => {
let r = hex.substr(0,2),
g = hex.substr(2,2),
b = hex.substr(4,2);
return {
r: parseInt(r, 16),
g: parseInt(g, 16),
b: parseInt(b, 16)
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment