MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / is_color_like

Function is_color_like

lib/matplotlib/colors.py:226–236  ·  view source on GitHub ↗

Return whether *c* as a valid Matplotlib :mpltype:`color` specifier.

(c)

Source from the content-addressed store, hash-verified

224
225
226def is_color_like(c):
227 """Return whether *c* as a valid Matplotlib :mpltype:`color` specifier."""
228 # Special-case nth color syntax because it cannot be parsed during setup.
229 if _is_nth_color(c):
230 return True
231 try:
232 to_rgba(c)
233 except (TypeError, ValueError):
234 return False
235 else:
236 return True
237
238
239def _has_alpha_channel(c):

Callers 4

validate_colorFunction · 0.90
test_is_color_likeFunction · 0.90
_check_color_likeFunction · 0.85

Calls 2

_is_nth_colorFunction · 0.85
to_rgbaFunction · 0.85

Tested by 1

test_is_color_likeFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…