diff --git a/manim_slides/slide/manim.py b/manim_slides/slide/manim.py index b95aa63..1ec491f 100644 --- a/manim_slides/slide/manim.py +++ b/manim_slides/slide/manim.py @@ -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 diff --git a/tests/test_slide.py b/tests/test_slide.py index 45ca147..52d03d2 100644 --- a/tests/test_slide.py +++ b/tests/test_slide.py @@ -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."""