Fix OkLab color negation (#2609)

This changes negation to effectively rotate hue by 180deg.
Previously, negation failed in certain cases and produced unexpected results.
This commit is contained in:
frozolotl 2023-11-08 20:10:37 +10:00 committed by GitHub
parent 2ce9d76025
commit cfb767346e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -906,7 +906,7 @@ impl Color {
pub fn negate(self) -> Color {
match self {
Self::Luma(c) => Self::Luma(Luma::new(1.0 - c.luma)),
Self::Oklab(c) => Self::Oklab(Oklab::new(c.l, 1.0 - c.a, 1.0 - c.b, c.alpha)),
Self::Oklab(c) => Self::Oklab(Oklab::new(c.l, -c.a, -c.b, c.alpha)),
Self::LinearRgb(c) => Self::LinearRgb(LinearRgba::new(
1.0 - c.red,
1.0 - c.green,