Skip to content
Merged
Changes from 1 commit
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
Next Next commit
numpydoc style parameters and link to colors tutorial for colors.to_hex
  • Loading branch information
story645 committed Aug 26, 2021
commit 58e8b948198206d30c139ce7aef306844e13d897
14 changes: 12 additions & 2 deletions lib/matplotlib/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,18 @@ 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 ``np.ma.masked``
Comment thread
story645 marked this conversation as resolved.
Outdated

keep_alpha: bool, optional
Uses the ``#rrggbb`` format if *keep_alpha* is False (the default),
otherwise uses ``#rrggbbaa``.
Comment thread
story645 marked this conversation as resolved.
Outdated

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