@@ -290,7 +290,10 @@ def _adjust(self, string, start=0):
290290 if color is None :
291291 m = RE_COLOR_START .match (string , start )
292292 if m :
293+ fullmatch = self .fullmatch
294+ self .fullmatch = False
293295 color2 , start = self ._adjust (string , start = start )
296+ self .fullmatch = fullmatch
294297 if color2 is None :
295298 raise ValueError ("Found unterminated or invalid 'color('" )
296299 color = color2 .convert ("srgb" )
@@ -635,19 +638,20 @@ def _parse(
635638 num_data = len (data )
636639 if num_data < num_channels :
637640 data = list (data ) + [alg .NaN ] * (num_channels - num_data )
638- coords = [alg .clamp (float (v ), * c .limit ) for c , v in zipl (space_class .CHANNELS , data )]
639- coords .append (alg .clamp (float (alpha ), * space_class .channels [- 1 ].limit ))
641+ coords = [float (c .limit (v ) if c .limit is not None else v ) for c , v in zipl (space_class .CHANNELS , data )]
642+ limit = space_class .channels [- 1 ].limit
643+ coords .append (float (limit (alpha ) if limit is not None else alpha ))
640644 obj = space_class , coords
641645
642646 # Parse a CSS string
643647 else :
644648 m = cls ._match (color , fullmatch = True , variables = variables )
645649 if m is None :
646650 raise ValueError ("'{}' is not a valid color" .format (color ))
647- coords = [alg .clamp (float (v ), * c .limit ) for c , v in zipl (m [0 ].CHANNELS , m [1 ])]
648- coords .append (alg .clamp (float (m [2 ]), * m [0 ].channels [- 1 ].limit ))
651+ coords = [float (c .limit (v ) if c .limit is not None else v ) for c , v in zipl (m [0 ].CHANNELS , m [1 ])]
652+ limit = m [0 ].channels [- 1 ].limit
653+ coords .append (float (limit (m [2 ]) if limit is not None else m [2 ]))
649654 obj = m [0 ], coords
650-
651655 # Handle a color instance
652656 elif isinstance (color , BASE ):
653657 space_class = cls .CS_MAP .get (color .space ())
0 commit comments