Skip to content

Instantly share code, notes, and snippets.

@Flushot
Created June 14, 2013 19:38
Show Gist options
  • Save Flushot/5784629 to your computer and use it in GitHub Desktop.
Save Flushot/5784629 to your computer and use it in GitHub Desktop.
Converts an RGB color value into hex, e.g.: (128,23,45) -> '#80172d'
rgb2hex = lambda r,g,b: '#'+''.join([ hex(x)[2:].zfill(2) for x in (r,g,b) ])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment