class_docstr: Advanced gradient that consists of more than two base colors.
  
  Example:
  
    >>> pal = AdvancedGradientPalette(["red", "black", "blue"], n=9)
    >>> pal.get(2)
    (0.5, 0.0, 0.0, 1.0)
    >>> pal.get(7)
    (0.0, 0.0, 0.75, 1.0)
class_docstr_tok: ["Advanced","gradient","that","consists","of","more","than","two","base","colors",".","Example",":",">",">",">","pal","=","AdvancedGradientPalette","(","[","``","red","''",",","``","black","''",",","``","blue","''","]",",","n=9",")",">",">",">","pal.get","(","2",")","(","0.5",",","0.0",",","0.0",",","1.0",")",">",">",">","pal.get","(","7",")","(","0.0",",","0.0",",","0.75",",","1.0",")"]
docstr: 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
docstr_tok: ["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"]
code: 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
      """
      super().__init__(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)
      ]
  
imports: from abc import ABCMeta, abstractmethod
  from math import ceil
label_desc: Use image node_id 1 to create a new AdvancedGradientPalette object from inherited base classes: Palette with example: obj = AdvancedGradientPalette(colors, indices, n)