def hex2rgb255(hexColor):
 if (hexColor[0] == '#'):
  hexColor = hexColor[1:]
 elif (hexColor[0:2].lower() == '0x'):
  hexColor = hexColor[2:]
 if (len(hexColor) == 3):
  hexColor = (((((hexColor[0] + '0') + hexColor[1]) + '0') + hexColor[2]) + '0')
 rgb = (int(hexColor[0:2], 16), int(hexColor[2:4], 16), int(hexColor[4:6], 16))
 return rgb

def hex2rgb255 ( hexColor ) : if ( hexColor [ 0 ] == '#' ) : hexColor = hexColor [ 1 : ] elif ( hexColor [ 0 : 2 ] . lower ( ) == '0x' ) : hexColor = hexColor [ 2 : ] if ( len ( hexColor ) == 3 ) : hexColor = ( ( ( ( ( hexColor [ 0 ] + '0' ) + hexColor [ 1 ] ) + '0' ) + hexColor [ 2 ] ) + '0' ) rgb = ( int ( hexColor [ 0 : 2 ] , 16 ) , int ( hexColor [ 2 : 4 ] , 16 ) , int ( hexColor [ 4 : 6 ] , 16 ) ) return rgb
convert a hex color string into an rgb triplet ranging from 0:255 .