A community-maintained Python framework for creating mathematical animations.
Provide alpha multiplied RGBA values to cairo (#2328)
Marcin Serwin78575174e4bc
diff --git a/manim/utils/color.py b/manim/utils/color.pyindex 30669fda5..fa48ac693 100644--- a/manim/utils/color.py+++ b/manim/utils/color.py@@ -491,8 +491,9 @@ def color_to_int_rgb(color: Color) -> np.ndarray:def color_to_int_rgba(color: Color, opacity: float = 1.0) -> np.ndarray:- alpha = int(255 * opacity)- return np.append(color_to_int_rgb(color), alpha)+ alpha_multiplier = np.vectorize(lambda x: int(x * opacity))++ return alpha_multiplier(np.append(color_to_int_rgb(color), 255))def color_gradient(diff --git a/tests/test_color.py b/tests/test_color.pyindex 073c90d57..dec03bf2a 100644--- a/tests/test_color.py+++ b/tests/test_color.py@@ -27,7 +27,7 @@ def test_background_color():S.camera.background_color = "#bbffbb"S.camera.background_opacity = 0.5S.renderer.update_frame(S)- assert np.all(S.renderer.get_frame()[0, 0] == np.array([187, 255, 187, 127]))+ assert np.all(S.renderer.get_frame()[0, 0] == np.array([93, 127, 93, 127]))def test_set_color():