mirror of
https://github.com/jeertmans/manim-slides.git
synced 2025-09-20 08:40:19 +08:00
feat(cli/lib): use scene background color as default (#160)
* Use scene background color as default * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Minor changes to feature: Read scene background * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Small fix for feature "Read bg color" * chore(ci): add typing ignore * fix(ci): typo --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jérome Eertmans <jeertmans@icloud.com>
This commit is contained in:
@ -54,6 +54,14 @@ class Slide(Scene): # type:ignore
|
||||
self.__loop_start_animation: Optional[int] = None
|
||||
self.__pause_start_animation = 0
|
||||
|
||||
@property
|
||||
def __background_color(self) -> str:
|
||||
"""Returns the scene's background color."""
|
||||
if MANIMGL:
|
||||
return self.camera_config["background_color"].hex # type: ignore
|
||||
else:
|
||||
return config["background_color"].hex # type: ignore
|
||||
|
||||
@property
|
||||
def __resolution(self) -> Tuple[int, int]:
|
||||
"""Returns the scene's resolution used during rendering."""
|
||||
@ -321,7 +329,10 @@ class Slide(Scene): # type:ignore
|
||||
with open(slide_path, "w") as f:
|
||||
f.write(
|
||||
PresentationConfig(
|
||||
slides=self.__slides, files=files, resolution=self.__resolution
|
||||
slides=self.__slides,
|
||||
files=files,
|
||||
resolution=self.__resolution,
|
||||
background_color=self.__background_color,
|
||||
).json(indent=2)
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user