(self, colors, indices=None, n=256)
Creates an advanced gradient palette

        @param colors: the colors in the gradient.
        @param indices: the color indices belonging to the given colors. If
          C{None}, the colors are distributed equidistantly
        @param n: the total number of colors in the palette
Creates an advanced gradient palette
Creates an advanced gradient palette
def __init__(self, colors, indices=None, n=256):
        """Creates an advanced gradient palette

        @param colors: the colors in the gradient.
        @param indices: the color indices belonging to the given colors. If
          C{None}, the colors are distributed equidistantly
        @param n: the total number of colors in the palette
        """
        Palette.__init__(self, n)

        if indices is None:
            diff = float(n - 1) / (len(colors) - 1)
            indices = [i * diff for i in range(len(colors))]
        elif not hasattr(indices, "__iter__"):
            indices = [float(x) for x in indices]
        self._indices, self._colors = list(zip(*sorted(zip(indices, colors))))
        self._colors = [color_name_to_rgba(color) for color in self._colors]
        self._dists = [
            curr - prev for curr, prev in zip(self._indices[1:], self._indices)
        ]
def __init__ ( self , colors , indices = None , n = 256 ) : Palette . __init__ ( self , n ) if indices is None : diff = float ( n - 1 ) / ( len ( colors ) - 1 ) indices = [ i * diff for i in range ( len ( colors ) ) ] elif not hasattr ( indices , "__iter__" ) : indices = [ float ( x ) for x in indices ] self . _indices , self . _colors = list ( zip ( * sorted ( zip ( indices , colors ) ) ) ) self . _colors = [ color_name_to_rgba ( color ) for color in self . _colors ] self . _dists = [ curr - prev for curr , prev in zip ( self . _indices [ 1 : ] , self . _indices ) ]