def isValidColor(color):
 try:
  color = float(color)
  return True
 except Exception:
  if (isinstance(color, basestring) and len(color)):
   return ((color.lower() in colors255.keys()) or (color[0] == '#') or (color[0:2] == '0x'))
  return ((type(color) in [tuple, list, numpy.ndarray]) or (not color))

def isValidColor ( color ) : try : color = float ( color ) return True except Exception : if ( isinstance ( color , basestring ) and len ( color ) ) : return ( ( color . lower ( ) in colors255 . keys ( ) ) or ( color [ 0 ] == '#' ) or ( color [ 0 : 2 ] == '0x' ) ) return ( ( type ( color ) in [ tuple , list , numpy . ndarray ] ) or ( not color ) )
check color validity .