to_hex

to_hex(color, space='rgb', cycle=None, keep_alpha=True)[source]

Translate the color in any format and from any colorspace to a HEX string. This is a generalization of matplotlib.colors.to_hex.

Parameters
  • %(param.to_rgb)s

  • keep_alpha (bool, optional) – Whether to keep the opacity channel. If True an 8-digit HEX is returned. Otherwise a 6-digit HEX is returned. Default is True.

Returns

%(return.hex)s