Skip to content

Instantly share code, notes, and snippets.

@zooid
Forked from matthewkremer/hex_to_rgb.py
Created August 17, 2022 19:45
Show Gist options
  • Save zooid/ba1ce83059560a17853d2596fb99dc0a to your computer and use it in GitHub Desktop.
Save zooid/ba1ce83059560a17853d2596fb99dc0a to your computer and use it in GitHub Desktop.
Python Hex Code to RGB Value
def hex_to_rgb(hex):
hex = hex.lstrip('#')
hlen = len(hex)
return tuple(int(hex[i:i+hlen/3], 16) for i in range(0, hlen, hlen/3))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment