def get_single_color_func(color):
 (old_r, old_g, old_b) = ImageColor.getrgb(color)
 rgb_max = 255.0
 (h, s, v) = colorsys.rgb_to_hsv((old_r / rgb_max), (old_g / rgb_max), (old_b / rgb_max))
 def single_color_func(word=None, font_size=None, position=None, orientation=None, font_path=None, random_state=None):
  'Random color generation.\n\n        Additional coloring method. It picks a random value with hue and\n        saturation based on the color given to the generating function.\n\n        Parameters\n        ----------\n        word, font_size, position, orientation  : ignored.\n\n        random_state : random.Random object or None, (default=None)\n          If a random object is given, this is used for generating random\n          numbers.\n\n        '
  if (random_state is None):
   random_state = Random()
  (r, g, b) = colorsys.hsv_to_rgb(h, s, random_state.uniform(0.2, 1))
  return 'rgb({:.0f}, {:.0f}, {:.0f})'.format((r * rgb_max), (g * rgb_max), (b * rgb_max))
 return single_color_func

def get_single_color_func ( color ) : ( old_r , old_g , old_b ) = ImageColor . getrgb ( color ) rgb_max = 255.0 ( h , s , v ) = colorsys . rgb_to_hsv ( ( old_r / rgb_max ) , ( old_g / rgb_max ) , ( old_b / rgb_max ) ) def single_color_func ( word = None , font_size = None , position = None , orientation = None , font_path = None , random_state = None ) : if ( random_state is None ) : random_state = Random ( ) ( r , g , b ) = colorsys . hsv_to_rgb ( h , s , random_state . uniform ( 0.2 , 1 ) ) return 'rgb({:.0f}, {:.0f}, {:.0f})' . format ( ( r * rgb_max ) , ( g * rgb_max ) , ( b * rgb_max ) ) return single_color_func
create a color function which returns a single hue and saturation with .