英文:
Objects' color after changing background color in manim
问题
我尝试更改manim视频中场景的背景颜色为self.camera.background-color= WHITE
,背景颜色变了,但所有文本仍然是白色。
有其他方法可以反转场景中的所有颜色吗,或者我们必须通过.set_color(BLACK)
来定义每个对象的颜色?🤔 谢谢回复...还是新手😅
英文:
I'm trying to change the background of my Scene in manim video with a self.camera.background-color= WHITE
, the background changed well but all texts are still white.
Is there any other methods to invert all colors in the scene or we have to define each object's color by a .set_color(BLACK)
??🤔 Thanks for responding...still newbie😅
答案1
得分: 1
from manim import *
config.background_color = "#a0a0a0"
Tex.set_default(color=BLACK)
MathTex.set_default(color=TEAL)
Text.set_default(color=PURE_GREEN)
Square.set_default(color=PURE_BLUE)
Circle.set_default(color=PURE_RED)
class test(Scene):
def construct(self):
sq = Square().to_corner(UR)
circ = Circle().to_corner(UL)
text = Text("Hello World").to_edge(LEFT)
tex = Tex(r"Hello \LaTeX").shift(UP)
mathtex = MathTex(r"a^2+b^2=c^2").shift(DOWN)
self.add(sq, circ, text, tex, mathtex)
在Manim Discord服务器上,有一些更高级的解决方案,可以定义自己的颜色方案。
<details>
<summary>英文:</summary>
You can set the default colors for all different types of objects in Manim.
```python
from manim import *
config.background_color = "#a0a0a0"
Tex.set_default(color=BLACK)
MathTex.set_default(color=TEAL)
Text.set_default(color=PURE_GREEN)
Square.set_default(color=PURE_BLUE)
Circle.set_default(color=PURE_RED)
class test(Scene):
def construct(self):
sq = Square().to_corner(UR)
circ = Circle().to_corner(UL)
text = Text("Hello World").to_edge(LEFT)
tex = Tex(r"Hello \LaTeX").shift(UP)
mathtex = MathTex(r"a^2+b^2=c^2").shift(DOWN)
self.add(sq,circ,text,tex,mathtex)
On the Manim Discord server there are some more advanced solution for defining your own color schemes...
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论