mirror of
https://github.com/typst/typst
synced 2025-05-14 17:15:28 +08:00
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:
parent
2ce9d76025
commit
cfb767346e
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user