Fix hue mixing for Lcha and Oklcha (#14468)
# Objective Fix erroneous hue mixing in `Lcha` and `Oklcha`. Purple + Red == Green is the current behavior. ## Solution Use `crate::color_ops::lerp_hue` to handle the wrap-around at 360 degrees, the same way that `Hsla`, `Hsva`, and `Hwba` do it. ## Testing Game jamming, but tested that the workaround below produces correct-looking colors in my jam game.
This commit is contained in:
parent
3a880b5c30
commit
e7e10f2c0f
@ -118,7 +118,7 @@ impl Mix for Lcha {
|
|||||||
Self {
|
Self {
|
||||||
lightness: self.lightness * n_factor + other.lightness * factor,
|
lightness: self.lightness * n_factor + other.lightness * factor,
|
||||||
chroma: self.chroma * n_factor + other.chroma * factor,
|
chroma: self.chroma * n_factor + other.chroma * factor,
|
||||||
hue: self.hue * n_factor + other.hue * factor,
|
hue: crate::color_ops::lerp_hue(self.hue, other.hue, factor),
|
||||||
alpha: self.alpha * n_factor + other.alpha * factor,
|
alpha: self.alpha * n_factor + other.alpha * factor,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -114,7 +114,7 @@ impl Mix for Oklcha {
|
|||||||
Self {
|
Self {
|
||||||
lightness: self.lightness * n_factor + other.lightness * factor,
|
lightness: self.lightness * n_factor + other.lightness * factor,
|
||||||
chroma: self.chroma * n_factor + other.chroma * factor,
|
chroma: self.chroma * n_factor + other.chroma * factor,
|
||||||
hue: self.hue * n_factor + other.hue * factor,
|
hue: crate::color_ops::lerp_hue(self.hue, other.hue, factor),
|
||||||
alpha: self.alpha * n_factor + other.alpha * factor,
|
alpha: self.alpha * n_factor + other.alpha * factor,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user