Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ENH: add XKCD colorname -> hex mapping #5775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Mar 29, 2016
Prev Previous commit
Next Next commit
MNT: always validate alpha as [0, 1] or None
  • Loading branch information
tacaswell committed Jan 2, 2016
commit bda202b78eef4374f69bda9d011313645ec206ce
5 changes: 3 additions & 2 deletions 5 lib/matplotlib/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ def to_rgba(self, arg, alpha=None):
except AttributeError:
pass

if alpha is not None and (alpha < 0.0 or alpha > 1.0):
raise ValueError("alpha must be in range 0-1")

try:
if not cbook.is_string_like(arg) and cbook.iterable(arg):
if len(arg) == 4:
Expand All @@ -211,8 +214,6 @@ def to_rgba(self, arg, alpha=None):
'number in rbga sequence outside 0-1 range')
if alpha is None:
return tuple(arg)
if alpha < 0.0 or alpha > 1.0:
raise ValueError("alpha must be in range 0-1")
return arg[0], arg[1], arg[2], alpha
if len(arg) == 3:
r, g, b = arg
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.