From 685b01908ca98cdbab20ea5c788f32713e412262 Mon Sep 17 00:00:00 2001 From: John Payne <20407779+johngpayne@users.noreply.github.com> Date: Thu, 2 Jul 2026 15:33:16 +0100 Subject: [PATCH] Very simple fix for where linear gradient is used as a border between, say, a slider and its background. Interpolating as SRGB involves a conversion in rust and conversion back in shader using different maths leading to slightly off colors, interpolating as linear is clean and produces exact results --- crates/bevy_feathers/src/controls/number_input.rs | 2 +- crates/bevy_feathers/src/controls/slider.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/bevy_feathers/src/controls/number_input.rs b/crates/bevy_feathers/src/controls/number_input.rs index 2eb2302809805..6769d021257e2 100644 --- a/crates/bevy_feathers/src/controls/number_input.rs +++ b/crates/bevy_feathers/src/controls/number_input.rs @@ -192,7 +192,7 @@ impl FeathersNumberInput { ColorStop::new(Color::NONE, percent(50)), ColorStop::new(Color::NONE, percent(100)), ], - color_space: InterpolationColorSpace::Srgba, + color_space: InterpolationColorSpace::LinearRgba, })]) EntityCursor::System(bevy_window::SystemCursorIcon::ColResize) on(number_input_init) diff --git a/crates/bevy_feathers/src/controls/slider.rs b/crates/bevy_feathers/src/controls/slider.rs index 68c7ae32b2087..51d97069e10a9 100644 --- a/crates/bevy_feathers/src/controls/slider.rs +++ b/crates/bevy_feathers/src/controls/slider.rs @@ -105,7 +105,7 @@ impl FeathersSlider { ColorStop::new(Color::NONE, percent(50)), ColorStop::new(Color::NONE, percent(100)), ], - color_space: InterpolationColorSpace::Srgba, + color_space: InterpolationColorSpace::LinearRgba, })]) Children [( // Text container @@ -177,7 +177,7 @@ pub fn slider_bundle(props: FeathersSliderProps, overrides: B) -> imp ColorStop::new(Color::NONE, percent(50)), ColorStop::new(Color::NONE, percent(100)), ], - color_space: InterpolationColorSpace::Srgba, + color_space: InterpolationColorSpace::LinearRgba, })]), overrides, children![(