Skip to content

Instantly share code, notes, and snippets.

@RinatValiullov
Last active November 21, 2017 21:57
Show Gist options
  • Save RinatValiullov/a39cd3d3804c53038d4f638f7d2166e6 to your computer and use it in GitHub Desktop.
Save RinatValiullov/a39cd3d3804c53038d4f638f7d2166e6 to your computer and use it in GitHub Desktop.
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