diff options
| author | frozolotl <44589151+frozolotl@users.noreply.github.com> | 2023-11-08 20:10:37 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-08 11:10:37 +0100 |
| commit | cfb767346e7879ea021187856a61eedaa1d46f7c (patch) | |
| tree | 1165ae62b21ff61a6784b235effe1d48a8aeab2e /crates | |
| parent | 2ce9d76025cdf90640da9c6e908dd7802582b89c (diff) | |
Fix OkLab color negation (#2609)
This changes negation to effectively rotate hue by 180deg.
Previously, negation failed in certain cases and produced unexpected results.
Diffstat (limited to 'crates')
| -rw-r--r-- | crates/typst/src/geom/color.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/typst/src/geom/color.rs b/crates/typst/src/geom/color.rs index bf04408c..3a02a8c2 100644 --- a/crates/typst/src/geom/color.rs +++ b/crates/typst/src/geom/color.rs @@ -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, |
