Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Added tex_to_color_map abilty to TexMobject config

Grant Sandersonc2a67346f9a1
diff --git a/mobject/svg/tex_mobject.py b/mobject/svg/tex_mobject.py
index 52da3c0e1..16eebe7f3 100644
--- a/mobject/svg/tex_mobject.py
+++ b/mobject/svg/tex_mobject.py
@@ -131,6 +131,7 @@ class TexMobject(SingleStringTexMobject):
CONFIG = {
"arg_separator": " ",
"substrings_to_isolate": [],
+ "tex_to_color_map": {},
}
def __init__(self, *tex_strings, **kwargs):
@@ -141,13 +142,18 @@ class TexMobject(SingleStringTexMobject):
self, self.arg_separator.join(tex_strings), **kwargs
)
self.break_up_by_substrings()
+ self.set_color_by_tex_to_color_map(self.tex_to_color_map)
if self.organize_left_to_right:
self.organize_submobjects_left_to_right()
def break_up_tex_strings(self, tex_strings):
+ substrings_to_isolate = op.add(
+ self.substrings_to_isolate,
+ self.tex_to_color_map.keys()
+ )
split_list = split_string_list_to_isolate_substring(
- tex_strings, *self.substrings_to_isolate
+ tex_strings, *substrings_to_isolate
)
split_list = map(str.strip, split_list)
split_list = filter(lambda s: s != '', split_list)