#NEWLINE# def color_scale( begin_hsl , end_hsl , nb ) : #NEWLINE# #INDENT# "Returns a list of nb color HSL tuples between begin_hsl and end_hsl\n\n    >>> from colour import color_scale\n\n    >>> [rgb2hex(hsl2rgb(hsl)) for hsl in color_scale((0, 1, 0.5),\n    ...                                               (1, 1, 0.5), 3)]\n    ['#f00', '#0f0', '#00f', '#f00']\n\n    >>> [rgb2hex(hsl2rgb(hsl))\n    ...  for hsl in color_scale((0, 0, 0),\n    ...                         (0, 0, 1),\n    ...                         15)]  # doctest: +ELLIPSIS\n    ['#000', '#111', '#222', ..., '#ccc', '#ddd', '#eee', '#fff']\n\n    Of course, asking for negative values is not supported:\n\n    >>> color_scale((0, 1, 0.5), (1, 1, 0.5), -2)\n    Traceback (most recent call last):\n    ...\n    ValueError: Unsupported negative number of colors (nb=-2).\n\n    " #NEWLINE# if ( nb < 0 ) : #NEWLINE# #INDENT# raise ValueError ( ( 'Unsupported negative number of colors (nb=%r).' % nb ) ) #NEWLINE# #UNINDENT# step = ( tuple ( [ ( float ( ( end_hsl [ i ] - begin_hsl [ i ] ) ) / nb ) for i in range ( 0 , 3 ) ] ) if ( nb > 0 ) else ( 0 , 0 , 0 ) ) #NEWLINE# def mul( step , value ) : #NEWLINE# #INDENT# return tuple ( [ ( v * value ) for v in step ] ) #NEWLINE# #UNINDENT# def add_v( step , step2 ) : #NEWLINE# #INDENT# return tuple ( [ ( v + step2 [ i ] ) for ( i , v ) in enumerate ( step ) ] ) #NEWLINE# #UNINDENT# return [ add_v ( begin_hsl , mul ( add_v , r ) ) for r in range ( 0 , ( nb + 1 ) ) ]