fix(lib): correctly retrieve background color (#414)

Closes #409
This commit is contained in:
Jérome Eertmans
2024-04-16 14:33:27 +02:00
committed by GitHub
parent 24ee23af11
commit 498e9af2bf
2 changed files with 9 additions and 1 deletions

View File

@ -23,7 +23,7 @@ class Slide(BaseSlide, Scene): # type: ignore[misc]
@property
def _background_color(self) -> str:
color = config["background_color"]
color = self.camera.background_color
if hex_color := getattr(color, "hex", None):
return hex_color # type: ignore
else: # manim>=0.18, see https://github.com/ManimCommunity/manim/pull/3020

View File

@ -6,6 +6,7 @@ import numpy as np
import pytest
from click.testing import CliRunner
from manim import (
BLACK,
BLUE,
DOWN,
LEFT,
@ -108,6 +109,13 @@ class TestSlide:
assert len(self._canvas) == 0
assert self._wait_time_between_slides == 0.0
@assert_constructs
class TestBackgroundColor(Slide):
def construct(self) -> None:
assert self._background_color == BLACK.to_hex() # DEFAULT
self.camera.background_color = BLUE
assert self._background_color == BLUE.to_hex()
@assert_renders
class TestMultipleAnimationsInLastSlide(Slide):
"""Check against solution for issue #161."""