Skip to content

Commit d9c1d6f

Browse files
committed
actually fix _internal_from_string
1 parent 9dd9ba2 commit d9c1d6f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

manim/utils/color/core.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ def __init__(
210210
# This is not expected to be called on module initialization time
211211
# It can be horribly slow to convert a string to a color because
212212
# it has to access the dictionary of colors and find the right color
213+
self._internal_value = ManimColor._internal_from_string(value)
213214
elif isinstance(value, (list, tuple, np.ndarray)):
214215
length = len(value)
215216
if all(isinstance(x, float) for x in value):
@@ -316,8 +317,10 @@ def _internal_from_rgba(rgba: RGBA_Tuple_Float) -> ManimColorInternal:
316317
def _internal_from_string(name: str) -> ManimColorInternal:
317318
from . import _all_color_dict
318319

319-
if name.upper() in _all_color_dict:
320-
return _all_color_dict[name]._internal_value
320+
upper_name = name.upper()
321+
322+
if upper_name in _all_color_dict:
323+
return _all_color_dict[upper_name]._internal_value
321324
else:
322325
raise ValueError(f"Color {name} not found")
323326

0 commit comments

Comments
 (0)