matplotlib / 3.7 / _as_gen / matplotlib.colors.to_hex.html

matplotlib.colors.to_hex

matplotlib.colors.to_hex(c, keep_alpha=False)[source]

Convert c to a hex color.

Parameters:
ccolor or numpy.ma.masked
keep_alphabool, default: False

If False, use the #rrggbb format, otherwise use #rrggbbaa.

Returns:
str

#rrggbb or #rrggbbaa hex color string

© 2012–2023 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/stable/api/_as_gen/matplotlib.colors.to_hex.html