Skip to content

Commit ff1696c

Browse files
authored
can't pass list of colors in set_color() fixed (#993)
* can't pass list of colors in set_color() fixed * Add gradient test * black * black
1 parent 79eb198 commit ff1696c

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

manim/mobject/types/vectorized_mobject.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,12 @@ def match_style(self, vmobject, family=True):
280280
def set_color(self, color, family=True):
281281
self.set_fill(color, family=family)
282282
self.set_stroke(color, family=family)
283-
self.color = colour.Color(color)
283+
284+
# check if a list of colors is passed to color
285+
if isinstance(color, str):
286+
self.color = colour.Color(color)
287+
else:
288+
self.color = color
284289
return self
285290

286291
def set_opacity(self, opacity, family=True):
Binary file not shown.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import pytest
2+
3+
from manim import *
4+
from ..utils.testing_utils import get_scenes_to_test
5+
from ..utils.GraphicalUnitTester import GraphicalUnitTester
6+
7+
8+
class GradientTest(Scene):
9+
def construct(self):
10+
c = Circle(fill_opacity=1).set_color(color=[YELLOW, GREEN])
11+
self.play(Animation(c))
12+
13+
14+
MODULE_NAME = "modifier_methods"
15+
16+
17+
@pytest.mark.parametrize("scene_to_test", get_scenes_to_test(__name__), indirect=False)
18+
def test_scene(scene_to_test, tmpdir, show_diff):
19+
GraphicalUnitTester(scene_to_test[1], MODULE_NAME, tmpdir).test(show_diff=show_diff)

0 commit comments

Comments
 (0)