Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 20170d7

Browse files
authored
Merge pull request #20913 from story645/story645-to_hex
[Doc] colors.to_hex input & output
2 parents 2e34f38 + 143c30e commit 20170d7

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/matplotlib/colors.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,17 @@ def to_hex(c, keep_alpha=False):
390390
"""
391391
Convert *c* to a hex color.
392392
393-
Uses the ``#rrggbb`` format if *keep_alpha* is False (the default),
394-
``#rrggbbaa`` otherwise.
393+
Parameters
394+
----------
395+
c : :doc:`color </tutorials/colors/colors>` or `numpy.ma.masked`
396+
397+
keep_alpha: bool, default: False
398+
If False, use the ``#rrggbb`` format, otherwise use ``#rrggbbaa``.
399+
400+
Returns
401+
-------
402+
str
403+
``#rrggbb`` or ``#rrggbbaa`` hex color string
395404
"""
396405
c = to_rgba(c)
397406
if not keep_alpha:

0 commit comments

Comments
 (0)