From eefa6366660ad226ce7b616fe9fa21e2741f1ecb Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Fri, 11 Feb 2022 13:39:23 +0100 Subject: [PATCH] Improve the contrast of the default light mode style Makes backgrounds brighter and foregrounds darker. --- CHANGELOG.md | 1 + egui/src/style.rs | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c38a1dc49d..eeb02be9a55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ NOTE: [`epaint`](epaint/CHANGELOG.md), [`eframe`](eframe/CHANGELOG.md), [`egui_w * ⚠️ `Context::input` and `Ui::input` now locks a mutex. This can lead to a dead-lock is used in an `if let` binding! * `if let Some(pos) = ui.input().pointer.latest_pos()` and similar must now be rewritten on two lines. * Search for this problem in your code using the regex `if let .*input`. +* Better contrast in the default light mode style ([#1238](https://github.com/emilk/egui/pull/1238)). * Renamed `CtxRef` to `Context` ([#1050](https://github.com/emilk/egui/pull/1050)). * `Context` can now be cloned and stored between frames ([#1050](https://github.com/emilk/egui/pull/1050)). * Renamed `Ui::visible` to `Ui::is_visible`. diff --git a/egui/src/style.rs b/egui/src/style.rs index 7469c561ad4..9024a002a1e 100644 --- a/egui/src/style.rs +++ b/egui/src/style.rs @@ -607,7 +607,7 @@ impl Visuals { selection: Selection::default(), hyperlink_color: Color32::from_rgb(90, 170, 255), faint_bg_color: Color32::from_gray(24), - extreme_bg_color: Color32::from_gray(10), + extreme_bg_color: Color32::from_gray(10), // e.g. TextEdit background code_bg_color: Color32::from_gray(64), window_rounding: Rounding::same(6.0), window_shadow: Shadow::big_dark(), @@ -628,9 +628,9 @@ impl Visuals { widgets: Widgets::light(), selection: Selection::light(), hyperlink_color: Color32::from_rgb(0, 155, 255), - faint_bg_color: Color32::from_gray(240), - extreme_bg_color: Color32::from_gray(250), - code_bg_color: Color32::from_gray(200), + faint_bg_color: Color32::from_gray(245), + extreme_bg_color: Color32::from_gray(255), // e.g. TextEdit background + code_bg_color: Color32::from_gray(230), window_shadow: Shadow::big_light(), popup_shadow: Shadow::small_light(), ..Self::dark() @@ -709,21 +709,21 @@ impl Widgets { pub fn light() -> Self { Self { noninteractive: WidgetVisuals { - bg_fill: Color32::from_gray(235), // window background + bg_fill: Color32::from_gray(248), // window background - should be distinct from TextEdit background bg_stroke: Stroke::new(1.0, Color32::from_gray(190)), // separators, indentation lines, windows outlines - fg_stroke: Stroke::new(1.0, Color32::from_gray(100)), // normal text color + fg_stroke: Stroke::new(1.0, Color32::from_gray(80)), // normal text color rounding: Rounding::same(2.0), expansion: 0.0, }, inactive: WidgetVisuals { - bg_fill: Color32::from_gray(215), // button background + bg_fill: Color32::from_gray(230), // button background bg_stroke: Default::default(), - fg_stroke: Stroke::new(1.0, Color32::from_gray(80)), // button text + fg_stroke: Stroke::new(1.0, Color32::from_gray(60)), // button text rounding: Rounding::same(2.0), expansion: 0.0, }, hovered: WidgetVisuals { - bg_fill: Color32::from_gray(210), + bg_fill: Color32::from_gray(220), bg_stroke: Stroke::new(1.0, Color32::from_gray(105)), // e.g. hover over window edge or button fg_stroke: Stroke::new(1.5, Color32::BLACK), rounding: Rounding::same(3.0),