Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions manim/mobject/text/text_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,9 @@ def add_line_to(end: Point3D) -> None:
self.scale(TEXT_MOB_SCALE_FACTOR)
self.initial_height = self.height

if color is not None:
self.color = parsed_color

def __repr__(self) -> str:
return f"Text({repr(self.original_text)})"

Expand Down
7 changes: 7 additions & 0 deletions tests/test_graphical_units/test_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,10 @@ def test_text_color_inheritance():

# reset the default color so that future tests aren't affected by this change.
VMobject.set_default()


def test_text_constructor_color():
from manim import WHITE

text = Text("test", color=WHITE)
assert text.get_color().to_hex() == WHITE.to_hex()
Loading