def color_parser(colors, function):
 from numbers import Number
 if isinstance(colors, str):
  return function(colors)
 if (isinstance(colors, tuple) and isinstance(colors[0], Number)):
  return function(colors)
 if hasattr(colors, '__iter__'):
  if isinstance(colors, tuple):
   new_color_tuple = tuple((function(item) for item in colors))
   return new_color_tuple
  else:
   new_color_list = [function(item) for item in colors]
   return new_color_list

def color_parser ( colors , function ) : from numbers import Number if isinstance ( colors , str ) : return function ( colors ) if ( isinstance ( colors , tuple ) and isinstance ( colors [ 0 ] , Number ) ) : return function ( colors ) if hasattr ( colors , '__iter__' ) : if isinstance ( colors , tuple ) : new_color_tuple = tuple ( ( function ( item ) for item in colors ) ) return new_color_tuple else : new_color_list = [ function ( item ) for item in colors ] return new_color_list
takes color(s) and a function and applies the function on the color(s) in particular .