Last active
August 29, 2015 14:19
-
-
Save evuez/9c48db548960fe94008f to your computer and use it in GitHub Desktop.
Hex to RGB
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
# 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