diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py index dd5d22130904..254e2c1a203b 100644 --- a/lib/matplotlib/colors.py +++ b/lib/matplotlib/colors.py @@ -949,7 +949,7 @@ def with_alpha(self, alpha): if not isinstance(alpha, Real): raise TypeError(f"'alpha' must be numeric or None, not {type(alpha)}") if not 0 <= alpha <= 1: - ValueError("'alpha' must be between 0 and 1, inclusive") + raise ValueError("'alpha' must be between 0 and 1, inclusive") new_cm = self.copy() if not new_cm._isinit: new_cm._init()