Created
August 7, 2019 07:20
-
-
Save sioniks/e59d2381e9a6400bb12580502a5b20d8 to your computer and use it in GitHub Desktop.
#color #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 hexToRgb = hex => | |
hex.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i | |
,(m, r, g, b) => '#' + r + r + g + g + b + b) | |
.substring(1).match(/.{2}/g) | |
.map(x => parseInt(x, 16)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment