Skip to content

Instantly share code, notes, and snippets.

@colorswall
Created September 20, 2018 09:35
Show Gist options
  • Save colorswall/6a42cab412349e965e07a751b0852c41 to your computer and use it in GitHub Desktop.
Save colorswall/6a42cab412349e965e07a751b0852c41 to your computer and use it in GitHub Desktop.
RGB to HEX JavaScript convert
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