Copyright and License information Home
__ A B C D E F G H I L M P R S T U V W
Summary:
Some helpful hints!
This method takes a #RRGGBB spec as input and returns a tuple (R,G,B).
def getRGBFromSpec(specString): """converts a #RRGGBB spec to RGB. Returns (Red,Green,Blue) as integers """ if specString[0] == '#': specString = specString[1:] #zero-pad to ensure at least 6 chars specstring = specString + '000000' try: r = int(specString[0:2],16) g = int(specString[2:4],16) b = int(specString[4:6],16) except: r=g=b=0 return (r,g,b)