Last active
September 20, 2018 09:36
-
-
Save colorswall/ea2dced5ae0af5804d5d869d77ce59db to your computer and use it in GitHub Desktop.
HEX to RGB JavaScript convert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const hex2rgb = (hex, alpha) => { | |
const r = parseInt(hex.slice(1, 3), 16); | |
const g = parseInt(hex.slice(3, 5), 16); | |
const b = parseInt(hex.slice(5, 7), 16); | |
return { r, g, b }; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment