diff --git a/crates/ui-egui/src/theme.rs b/crates/ui-egui/src/theme.rs index d35e5657..1315d320 100644 --- a/crates/ui-egui/src/theme.rs +++ b/crates/ui-egui/src/theme.rs @@ -350,4 +350,15 @@ mod tests { } assert!(!Tokens::for_brightness(Brightness::Light).dark); } + + /// #1662: a slider's rail (`button_border`, see `widgets::slider`) stands out from the panel + /// in every brightness. + #[test] + fn slider_rails_show_on_every_panel() { + for b in [Brightness::Dark, Brightness::MediumDark, Brightness::MediumLight, Brightness::Light] { + let t = Tokens::for_brightness(b); + let gap = (i32::from(t.button_border.r()) - i32::from(t.panel.r())).abs(); + assert!(gap >= 24, "{b:?}: rail {:?} on panel {:?}", t.button_border, t.panel); + } + } } diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index 5ce5723b..e03c4a96 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -1014,7 +1014,9 @@ pub fn slider(ui: &mut Ui, slider: egui::Slider<'_>) -> Response { let t = Tokens::get(ui.ctx()); ui.scope(|ui| { let v = ui.visuals_mut(); - v.widgets.inactive.bg_fill = t.input_border; + // The buttons' border shows against the panel in every brightness; the fields' border + // all but vanished on Medium Dark's panel (#1662). + v.widgets.inactive.bg_fill = t.button_border; v.selection.bg_fill = t.accent; ui.add(slider.trailing_fill(true)) })