Skip to content

Commit 685b019

Browse files
committed
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
1 parent 306aaed commit 685b019

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

crates/bevy_feathers/src/controls/number_input.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ impl FeathersNumberInput {
192192
ColorStop::new(Color::NONE, percent(50)),
193193
ColorStop::new(Color::NONE, percent(100)),
194194
],
195-
color_space: InterpolationColorSpace::Srgba,
195+
color_space: InterpolationColorSpace::LinearRgba,
196196
})])
197197
EntityCursor::System(bevy_window::SystemCursorIcon::ColResize)
198198
on(number_input_init)

crates/bevy_feathers/src/controls/slider.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl FeathersSlider {
105105
ColorStop::new(Color::NONE, percent(50)),
106106
ColorStop::new(Color::NONE, percent(100)),
107107
],
108-
color_space: InterpolationColorSpace::Srgba,
108+
color_space: InterpolationColorSpace::LinearRgba,
109109
})])
110110
Children [(
111111
// Text container
@@ -177,7 +177,7 @@ pub fn slider_bundle<B: Bundle>(props: FeathersSliderProps, overrides: B) -> imp
177177
ColorStop::new(Color::NONE, percent(50)),
178178
ColorStop::new(Color::NONE, percent(100)),
179179
],
180-
color_space: InterpolationColorSpace::Srgba,
180+
color_space: InterpolationColorSpace::LinearRgba,
181181
})]),
182182
overrides,
183183
children![(

0 commit comments

Comments
 (0)