From 2b09a065f67e4a99438db5bb2be6a95fe4ed0988 Mon Sep 17 00:00:00 2001 From: Verte Date: Wed, 17 Aug 2022 14:00:10 +0000 Subject: [PATCH] Correctly use as_hsla_f32 in Add and AddAssign, fixes #5543 (#5546) Probably a copy-paste error, but `Add` and `AddAssign` should use `rhs.as_hlsa_f32()` instead of `rhs.as_linear_rgba_f32()` when the LHS is a `Color::Hsla`. Fixes #5543. Co-authored-by: Verte <105466627+vertesians@users.noreply.github.com> --- crates/bevy_render/src/color/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_render/src/color/mod.rs b/crates/bevy_render/src/color/mod.rs index d0eb1846da208..4a1467cfe5b1f 100644 --- a/crates/bevy_render/src/color/mod.rs +++ b/crates/bevy_render/src/color/mod.rs @@ -659,7 +659,7 @@ impl AddAssign for Color { lightness, alpha, } => { - let rhs = rhs.as_linear_rgba_f32(); + let rhs = rhs.as_hsla_f32(); *hue += rhs[0]; *saturation += rhs[1]; *lightness += rhs[2]; @@ -708,7 +708,7 @@ impl Add for Color { lightness, alpha, } => { - let rhs = rhs.as_linear_rgba_f32(); + let rhs = rhs.as_hsla_f32(); Color::Hsla { hue: hue + rhs[0], saturation: saturation + rhs[1],