|
24 | 24 | from ..mobject.types.image_mobject import AbstractImageMobject |
25 | 25 | from ..mobject.types.point_cloud_mobject import PMobject |
26 | 26 | from ..mobject.types.vectorized_mobject import VMobject |
27 | | -from ..utils.color import color_to_int_rgba |
| 27 | +from ..utils.color import ManimColor, ParsableManimColor, color_to_int_rgba |
28 | 28 | from ..utils.family import extract_mobject_family_members |
29 | 29 | from ..utils.images import get_full_raster_image_path |
30 | 30 | from ..utils.iterables import list_difference_update |
@@ -75,6 +75,8 @@ def __init__( |
75 | 75 | frame_height: float | None = None, |
76 | 76 | frame_width: float | None = None, |
77 | 77 | frame_rate: float | None = None, |
| 78 | + background_color: ParsableManimColor | None = None, |
| 79 | + background_opacity: float | None = None, |
78 | 80 | **kwargs, |
79 | 81 | ): |
80 | 82 | self.background_image = background_image |
@@ -106,9 +108,14 @@ def __init__( |
106 | 108 | frame_rate = config["frame_rate"] |
107 | 109 | self.frame_rate = frame_rate |
108 | 110 |
|
109 | | - # TODO: change this to not use kwargs.get |
110 | | - for attr in ["background_color", "background_opacity"]: |
111 | | - setattr(self, f"_{attr}", kwargs.get(attr, config[attr])) |
| 111 | + if background_color is None: |
| 112 | + self._background_color = ManimColor.parse(config["background_color"]) |
| 113 | + else: |
| 114 | + self._background_color = ManimColor.parse(background_color) |
| 115 | + if background_opacity is None: |
| 116 | + self._background_opacity = config["background_opacity"] |
| 117 | + else: |
| 118 | + self._background_opacity = background_opacity |
112 | 119 |
|
113 | 120 | # This one is in the same boat as the above, but it doesn't have the |
114 | 121 | # same name as the corresponding key so it has to be handled on its own |
|
0 commit comments