facelessuser / coloraide

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

Restrict correction algorithm to produce sane results in extreme cases #436

Closed facelessuser closed 1 month ago

facelessuser commented 1 month ago

When using ray trace and the adaptive lightness approach, Luv and its cylindrical counter part can produce chroma reduction curves that stress the algorithm in the dark blue region. This can yield yellows which make no sense.

Add a restriction in the correction code that projects the color onto the chroma reduction vector in the Lab model to restrict extreme results, outside the range of the vector, which can create colors outside the color space's ability to convert the color causing massive hue shifts.

Colors will still not be accurate, but they will be much closer to then intended target and be a more sane representation.

facelessuser commented 1 month ago

@gir-bot lgtm