Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions lib/matplotlib/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,17 @@ def 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.
Parameters
----------
c : :doc:`color </tutorials/colors/colors>` or `numpy.ma.masked`

keep_alpha: bool, default: False
If False, use the ``#rrggbb`` format, otherwise use ``#rrggbbaa``.

Returns
-------
str
``#rrggbb`` or ``#rrggbbaa`` hex color string
"""
c = to_rgba(c)
if not keep_alpha:
Expand Down