Created
September 20, 2018 09:35
-
-
Save colorswall/6a42cab412349e965e07a751b0852c41 to your computer and use it in GitHub Desktop.
RGB to HEX 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 rgb2hex = (r, g, b) => { | |
var rgb = b | (g << 8) | (r << 16); | |
return '#' + (0x1000000 + rgb).toString(16).slice(1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment