to_xyz(color, space='hcl', alpha=False)[source]

Translate color in any format to a tuple of channel values in any colorspace. This is the inverse of to_rgb.

  • color (color-spec) – The color. Sanitized with to_rgb.

  • space ({‘rgb’, ‘hsv’, ‘hpl’, ‘hsl’, ‘hcl’}, optional) – The colorspace for the output channel values.

  • alpha (bool, optional) – Whether to preserve the opacity channel, if it exists. Default is False.


color – Tuple of colorspace space channel values.