Skip to content

Instantly share code, notes, and snippets.

@evuez
Last active August 29, 2015 14:19
Show Gist options
  • Save evuez/9c48db548960fe94008f to your computer and use it in GitHub Desktop.
Save evuez/9c48db548960fe94008f to your computer and use it in GitHub Desktop.
Hex to RGB
# Python 2
def hex_to_rgb(hex_):
return unpack('BBBB', hex_.decode('hex'))
# Python 3
def hex_to_rgb(hex_):
import codecs
return unpack('BBBB', codecs.decode(hex_, 'hex'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment