Skip to content

fix(config): return a ManimColor from background_color property#4851

Open
Chessing234 wants to merge 1 commit into
ManimCommunity:mainfrom
Chessing234:fix/4801-background-color-manimcolor
Open

fix(config): return a ManimColor from background_color property#4851
Chessing234 wants to merge 1 commit into
ManimCommunity:mainfrom
Chessing234:fix/4801-background-color-manimcolor

Conversation

@Chessing234

Copy link
Copy Markdown

Changelog / Overview

config.background_color is annotated -> ManimColor but returned the raw stored value. When set via a config file or CLI (not the setter) that value is a plain str, so callers relying on ManimColor methods broke.

Fix

Wrap the stored value in ManimColor in the getter, using a lazy import to avoid the documented circular import (removes the stale # TODO). The setter already stored a ManimColor, so the normal path is unchanged.

Testing

config._d["background_color"] = "#123456"
isinstance(config.background_color, ManimColor)  # before: False, after: True

tests/test_config.py pass.

Fixes #4801

Made with Cursor

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 ManimCommunity#4801

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

config: return ManimColor instance from background_color property

1 participant