Change Text Colour Manim Community

Viewed 2445

I have been trying out Manim Community. I am wondering if there is a way to change the text colour to black through out the whole program by calling config.

I can change the background colour using config.background_color = WHITE. I have tried searching online and trying random things (like config.text_colour = BLACK) to no avail. Thanks!

3 Answers

One solution is to open the .../manim/mobject/svg/tex_mobject.py and change the colour there :

class TexMobject(SingleStringTexMobject):
    CONFIG = {
        "arg_separator": " ",
        "substrings_to_isolate": [],
        "tex_to_color_map": {},
        "color": YOUR_COLOUR,
    }

(credits to @Level-314 for this solution)

Of course this should also apply to Text.

On Mac, I found the file at: /users/<accountName>/library/python/3.8/lib/python/site-packages/manim/svg/text_mobject.py. On Windows, it was found to be here: C:\Users\<accountName>\AppData\Local\Programs\Python\Python38\Lib\site-packages\manim\mobject\svg\text_mobject.py Then, text_mobject.py, I did two/three things:

  1. In line 68, there is this: from ...utils.color import WHITE, Colors. I added from ...utils.color import BLACK, Colors underneath. It gave me an error if I skipped this step.

  2. I went to line 129 and changed color=WHITE to color=BLACK.

  3. Only needed on Windows: Go to line 699 and color: str = WHITE, to color: str = BLACK, Credit for helping me find this goes to olirwin in the comments.

Note: I am using Manim Community v0.4

Related