From c226d5729252efbef4be71bc28b40e52d3fdb035 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 51c3a21a7cdc93..0362d8386a9e43 100644 --- a/crates/bevy_render/src/color/mod.rs +++ b/crates/bevy_render/src/color/mod.rs @@ -745,7 +745,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]; @@ -794,7 +794,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],