diplomat.utils.colormaps.iter_colormap

diplomat.utils.colormaps.iter_colormap(cmap: Colormap, count: int, bytes: bool = False) Sequence[Tuple[float, float, float, float]][source]

Iterate a matplotlib colormap, returning a sequence of colors sampled from it.

Parameters:
  • cmap – The matplotlib Colormap to draw colors from.

  • count – The number of colors to be sampled from the colormap.

  • bytes – If True, returned colors are tuples of integers between 0 and 255, if False, they are tuples of floats between 0 and 1

Returns:

A list of colors. Each color is a tuple of 4 numbers, representing the red, green, blue, and alpha channels of the color.