lcms2.parse_colors

parse_colors(values: Any) → ndarray[source]

Parse a list of colours into an (N, 3) or (N, 4) float array.

Parameters:

values (sequence or ndarray) – Any mix of the forms parse_color accepts, or an (N, 3|4) array of floats (0..1) or integers (0..255). Colours with and without alpha cannot be mixed.

Returns:

ndarray, shape (N, 3) or (N, 4)

Raises:

ValueError – If any entry cannot be parsed or the alpha channels are mixed.

Examples

>>> from lcms2._parse import parse_colors
>>> parse_colors(["red", "#00f"]).shape
(2, 3)