Skip to content

Commit cb3d7c9

Browse files
committed
Update docs for RGBA support.
1 parent d9db062 commit cb3d7c9

File tree

2 files changed

+29
-14
lines changed

2 files changed

+29
-14
lines changed

doc/conf.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -334,5 +334,19 @@ def getapi(*args):
334334
sys.modules['sip'] = mocksip
335335
sys.modules['PyQt4'] = mockpyqt4
336336

337-
################# numpydoc config ####################
337+
# numpydoc config
338+
338339
numpydoc_show_class_members = False
340+
341+
# Skip deprecated members
342+
343+
def skip_deprecated(app, what, name, obj, skip, options):
344+
if skip:
345+
return skip
346+
skipped = {"matplotlib.colors": ["ColorConverter", "hex2color", "rgb2hex"]}
347+
skip_list = skipped.get(getattr(obj, "__module__", None))
348+
if skip_list is not None:
349+
return getattr(obj, "__name__", None) in skip_list
350+
351+
def setup(app):
352+
app.connect('autodoc-skip-member', skip_deprecated)

lib/matplotlib/colors.py

+14-13
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@
1717
1818
The module also provides functions for checking whether an object can be
1919
interpreted as a color (:func:`is_color_like`), for converting such an object
20-
to an RGBA tuple (:func:`to_rgba`) or to an HTML hex string (:func:`to_hex`),
21-
and a sequence of colors to an `(n, 4)` RGBA array (:func:`to_rgba_array`).
22-
Caching is used for efficiency.
20+
to an RGBA tuple (:func:`to_rgba`) or to an HTML-like hex string in the
21+
`#rrggbbaa` format (:func:`to_hex`), and a sequence of colors to an `(n, 4)`
22+
RGBA array (:func:`to_rgba_array`). Caching is used for efficiency.
2323
2424
Commands which take color arguments can use several formats to specify
2525
the colors. For the basic built-in colors, you can use a single letter
2626
27-
- b: blue
28-
- g: green
29-
- r: red
30-
- c: cyan
31-
- m: magenta
32-
- y: yellow
33-
- k: black
34-
- w: white
27+
- `b`: blue
28+
- `g`: green
29+
- `r`: red
30+
- `c`: cyan
31+
- `m`: magenta
32+
- `y`: yellow
33+
- `k`: black
34+
- `w`: white
3535
3636
To use the colors that are part of the active color cycle in the current style,
3737
use `C` followed by a digit. For example:
@@ -48,8 +48,9 @@
4848
4949
color = '#eeefff'
5050
51-
or you can pass an *R* , *G* , *B* tuple, where each of *R* , *G* , *B* are in
52-
the range [0,1].
51+
(possibly specifying an alpha value as well), or you can pass an `(r, g, b)`
52+
or `(r, g, b, a)` tuple, where each of `r`, `g`, `b` and `a` are in the range
53+
[0,1].
5354
5455
Finally, legal html names for colors, like 'red', 'burlywood' and 'chartreuse'
5556
are supported.

0 commit comments

Comments
 (0)