def xy_color(color):
 rgb_cie_converter = rgb_cie.Converter()
 hex_color_re = re.compile('(?<!\\w)([a-f0-9]){2}([a-f0-9]){2}([a-f0-9]){2}\\b', re.IGNORECASE)
 if (color in CSS_LITERALS):
  color = CSS_LITERALS[color]
 color = color.lstrip('#')
 if (not hex_color_re.match(color)):
  print 'Invalid color. Please use a 6-digit hex color.'
  sys.exit()
 return rgb_cie_converter.hexToCIE1931(color)

def xy_color ( color ) : rgb_cie_converter = rgb_cie . Converter ( ) hex_color_re = re . compile ( '(?<!\\w)([a-f0-9]){2}([a-f0-9]){2}([a-f0-9]){2}\\b' , re . IGNORECASE ) if ( color in CSS_LITERALS ) : color = CSS_LITERALS [ color ] color = color . lstrip ( '#' ) if ( not hex_color_re . match ( color ) ) : print 'Invalid color. Please use a 6-digit hex color.' sys . exit ( ) return rgb_cie_converter . hexToCIE1931 ( color )
validate and convert hex color to xy space .