Skip to content

Instantly share code, notes, and snippets.

@fupslot
Created February 24, 2013 10:41
Show Gist options
  • Save fupslot/5023373 to your computer and use it in GitHub Desktop.
Save fupslot/5023373 to your computer and use it in GitHub Desktop.
javascript: rgb2hex
function rgbToHex(r, g, b) {
return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment