From 05ac2bd25cc1266c40232176ac4f8458d53a0c64 Mon Sep 17 00:00:00 2001 From: Taksh Date: Tue, 30 Jun 2026 23:01:59 +0530 Subject: [PATCH] fix(config): return a ManimColor from background_color property The property is annotated as ManimColor but returned the raw stored value, which is a plain string when set via a config file or CLI rather than the setter. Wrap the value in ManimColor (lazy import to avoid the circular import) so callers can rely on ManimColor methods. Fixes #4801 Co-authored-by: Cursor --- manim/_config/utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/manim/_config/utils.py b/manim/_config/utils.py index 3e45846539..20aaf54bcc 100644 --- a/manim/_config/utils.py +++ b/manim/_config/utils.py @@ -1190,11 +1190,14 @@ def frame_rate(self) -> float: def frame_rate(self, value: float) -> None: self._d.__setitem__("frame_rate", value) - # TODO: This was parsed before maybe add ManimColor(val), but results in circular import @property def background_color(self) -> ManimColor: """Background color of the scene (-c).""" - return self._d["background_color"] + # Lazy import avoids a circular import at module load; guarantees the + # return value matches the annotation even if _d holds a raw value (#4801). + from manim.utils.color import ManimColor + + return ManimColor(self._d["background_color"]) @background_color.setter def background_color(self, value: Any) -> None: