pyrc.core.visualization.color.color#

available(kind: str | None = None) tuple[str, ...]#

Return names of all loaded colormaps.

Parameters:

kind (str or None) – Filter by type: ‘uniform’, ‘explicit’, ‘discrete’, or None for all.

cycle_palette(cmap: str = 'managua10') Generator[np.ndarray, None, None]#

Yield RGB colours from a colormap in order, cycling indefinitely.

Parameters:

cmap (str) – Colormap name.

Yields:

np.ndarray – Shape (3,), dtype float32.

get_palette(cmap: str = 'managua10') ndarray#

Return all swatches of a discrete palette as (N, 3) float32 array.

Parameters:

cmap (str) – Name of a discrete colormap.

Returns:

Shape (N, 3), dtype float32.

Return type:

np.ndarray

Raises:
  • KeyError – If cmap is not found.

  • TypeError – If cmap is not a discrete palette.

make_color_mapper(cmap: str = 'managua') Callable[[float | int | ndarray], ndarray]#

Convenience: returns f(v)->rgb for one colormap name.

value_to_rgb(value: float | int | ndarray, cmap: str = 'managua') ndarray#

Map relative value(s) in [0, 1] to RGB using a loaded colormap.

Parameters:
  • value (float, int, or np.ndarray) – Scalar or array of values in [0, 1].

  • cmap (str) – Colormap name.

Returns:

Shape (…, 3), dtype float32.

Return type:

np.ndarray