File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -210,6 +210,7 @@ def __init__(
210
210
# This is not expected to be called on module initialization time
211
211
# It can be horribly slow to convert a string to a color because
212
212
# it has to access the dictionary of colors and find the right color
213
+ self ._internal_value = ManimColor ._internal_from_string (value )
213
214
elif isinstance (value , (list , tuple , np .ndarray )):
214
215
length = len (value )
215
216
if all (isinstance (x , float ) for x in value ):
@@ -316,8 +317,10 @@ def _internal_from_rgba(rgba: RGBA_Tuple_Float) -> ManimColorInternal:
316
317
def _internal_from_string (name : str ) -> ManimColorInternal :
317
318
from . import _all_color_dict
318
319
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
321
324
else :
322
325
raise ValueError (f"Color { name } not found" )
323
326
You can’t perform that action at this time.
0 commit comments