0.12.0a10 fixed rgb -> oklch color converter

This commit is contained in:
Yusur 2026-01-09 10:56:46 +01:00
parent fb245f7d12
commit edd52ffeed
2 changed files with 3 additions and 3 deletions

View file

@ -38,7 +38,7 @@ from .http import WantsContentType
from .color import OKLabColor, chalk, WebColor, RGBColor, LinearRGBColor, XYZColor, OKLabColor from .color import OKLabColor, chalk, WebColor, RGBColor, LinearRGBColor, XYZColor, OKLabColor
from .mat import Matrix from .mat import Matrix
__version__ = "0.12.0a9" __version__ = "0.12.0a10"
__all__ = ( __all__ = (
'ConfigOptions', 'ConfigParserConfigSource', 'ConfigSource', 'ConfigValue', 'ConfigOptions', 'ConfigParserConfigSource', 'ConfigSource', 'ConfigValue',

View file

@ -150,8 +150,8 @@ class RGBColor(namedtuple('_WebColor', 'red green blue')):
*New in 0.12.0* *New in 0.12.0*
""" """
return LinearRGBColor(*( return LinearRGBColor(*(
(i / 12.92 if abs(i / 255) <= 0.04045 else ((i / 255) / 12.92 if abs(i / 255) <= 0.04045 else
(-1 if i < 0 else 1) * (((abs(i / 255) + 0.55)) / 1.055) ** 2.4) for i in self (-1 if i < 0 else 1) * (((abs(i / 255) + 0.055)) / 1.055) ** 2.4) for i in self
)) ))
def to_oklab(self): def to_oklab(self):