facelessuser / coloraide

A library to aid in using colors
https://facelessuser.github.io/coloraide
MIT License
195 stars 12 forks source link

Oklch parsing error #257

Closed facelessuser closed 1 year ago

facelessuser commented 1 year ago
>>> Color('oklch(1 0 0)')
Traceback (most recent call last):
  File "<exec>", line 213, in execute
  File "<string>", line 1, in <module>
  File "/lib/python3.10/site-packages/coloraide/color.py", line 152, in __init__
    self._space, self._coords = self._parse(color, data, alpha, **kwargs)
  File "/lib/python3.10/site-packages/coloraide/color.py", line 228, in _parse
    raise ValueError("'{}' is not a valid color".format(color))
ValueError: 'oklch(1 0 0)' is not a valid color

Basically, when we refactored some things, we messed up the parsing of oklch(). We accidentally duplicated the angle requirement but had no test in place to catch that the parsing no longer worked.