|
29 | 29 | The module also provides functions for checking whether an object can be
|
30 | 30 | interpreted as a color (`is_color_like`), for converting such an object
|
31 | 31 | to an RGBA tuple (`to_rgba`) or to an HTML-like hex string in the
|
32 |
| -"#rrggbb" format (`to_hex`), and a sequence of colors to an (n, 4) |
| 32 | +"#rrggbb" format (` |
| 33 | +`), and a sequence of colors to an (n, 4) |
33 | 34 | RGBA array (`to_rgba_array`). Caching is used for efficiency.
|
34 | 35 |
|
35 | 36 | Colors that Matplotlib recognizes are listed at
|
@@ -390,8 +391,18 @@ def to_hex(c, keep_alpha=False):
|
390 | 391 | """
|
391 | 392 | Convert *c* to a hex color.
|
392 | 393 |
|
393 |
| - Uses the ``#rrggbb`` format if *keep_alpha* is False (the default), |
394 |
| - ``#rrggbbaa`` otherwise. |
| 394 | + Parameters |
| 395 | + ---------- |
| 396 | + c : :doc:`color </tutorials/colors/colors>` or ``np.ma.masked`` |
| 397 | +
|
| 398 | + keep_alpha: bool, optional |
| 399 | + Uses the ``#rrggbb`` format if *keep_alpha* is False (the default), |
| 400 | + otherwise uses ``#rrggbbaa``. |
| 401 | +
|
| 402 | + Returns |
| 403 | + ------- |
| 404 | + str |
| 405 | + ``#rrggbb`` or ``#rrggbbaa`` hex color string |
395 | 406 | """
|
396 | 407 | c=to_rgba(c)
|
397 | 408 | ifnotkeep_alpha:
|
|