ColorMap
- class compas.colors.ColorMap(colors)[source]
Bases:
object
Class providing a map for colors of a specific color palette.
- Parameters
colors (sequence[tuple[float, float, float]]) – A sequence of colors forming the map.
- Attributes
colors (list[
Color
]) – The colors of the map.
Examples
>>> import random >>> cmap = ColorMap.from_palette('bamako') >>> for i in range(100): ... color = cmap(random.random()) ...
>>> cmap = ColorMap.from_mpl('viridis') >>> n = 100 >>> for i in range(n): ... color = cmap(i, 0, n - 1) ...
>>> cmap = ColorMap.from_color(Color.red(), rangetype='light') >>> cmap.plot()
Methods
Construct a color map from a single color by varying luminance.
Construct a color map from matplotlib.
Construct a color map from a named palette.
Construct a color map from the complete rgb color space.
Construct a color map from three colors.
Create a color map from two colors.
Visualize the current map with the plotter.