You are reading documentation for the unreleased version of Matplotlib. Try searching for the released version of this page instead?
Version 2.1.1.post1120+g407a460
matplotlib
Fork me on GitHub

This Page

matplotlib.colors.to_hex

matplotlib.colors.to_hex(c, keep_alpha=False)

Convert c to a hex color.

Uses the #rrggbb format if keep_alpha is False (the default), #rrggbbaa otherwise.