From 6b9e08e10f32a1892dde52e5cf09549fdf0580e4 Mon Sep 17 00:00:00 2001 From: Mike Dilger Date: Thu, 7 Nov 2024 13:39:08 +1300 Subject: [PATCH] Revert "Default Theme: Adjust Panel colors and all clickable_frame() bacckground colors" This reverts commit 3b7f5db353e440b2df4afa1768df671ddafc5932. --- gossip-bin/src/ui/dm_chat_list.rs | 1 - gossip-bin/src/ui/handler.rs | 2 -- gossip-bin/src/ui/people/list.rs | 1 - gossip-bin/src/ui/people/lists.rs | 1 - gossip-bin/src/ui/theme/default.rs | 16 ++++------------ gossip-bin/src/ui/theme/mod.rs | 8 -------- gossip-bin/src/ui/widgets/list_entry.rs | 11 +---------- gossip-bin/src/ui/widgets/relay_entry.rs | 12 ++++++++++-- 8 files changed, 15 insertions(+), 37 deletions(-) diff --git a/gossip-bin/src/ui/dm_chat_list.rs b/gossip-bin/src/ui/dm_chat_list.rs index f40d9d0f6..4edfe2c65 100644 --- a/gossip-bin/src/ui/dm_chat_list.rs +++ b/gossip-bin/src/ui/dm_chat_list.rs @@ -66,7 +66,6 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, _frame: &mut eframe::Fra ui, app, Some(app.theme.main_content_bgcolor()), - Some(app.theme.hovered_content_bgcolor()), |ui, app| { ui.set_min_width(ui.available_width()); ui.set_min_height(AVATAR_SIZE_F32); diff --git a/gossip-bin/src/ui/handler.rs b/gossip-bin/src/ui/handler.rs index 63f37f4bf..1923ec654 100644 --- a/gossip-bin/src/ui/handler.rs +++ b/gossip-bin/src/ui/handler.rs @@ -124,7 +124,6 @@ pub(super) fn update_all_kinds(app: &mut GossipUi, ctx: &Context, ui: &mut Ui) { ui, app, Some(app.theme.main_content_bgcolor()), - Some(app.theme.hovered_content_bgcolor()), |ui, app| { ui.set_min_width(ui.available_width()); @@ -215,7 +214,6 @@ pub(super) fn update_kind(app: &mut GossipUi, _ctx: &Context, ui: &mut Ui, kind: ui, app, Some(app.theme.main_content_bgcolor()), - Some(app.theme.hovered_content_bgcolor()), |ui, app| { ui.set_min_width(ui.available_width()); diff --git a/gossip-bin/src/ui/people/list.rs b/gossip-bin/src/ui/people/list.rs index 4359922dc..1bad7bf05 100644 --- a/gossip-bin/src/ui/people/list.rs +++ b/gossip-bin/src/ui/people/list.rs @@ -222,7 +222,6 @@ pub(super) fn update( ui, app, Some(app.theme.main_content_bgcolor()), - Some(app.theme.hovered_content_bgcolor()), |ui, app| { ui.horizontal(|ui| { // Avatar first diff --git a/gossip-bin/src/ui/people/lists.rs b/gossip-bin/src/ui/people/lists.rs index 3fda7099b..7f2001743 100644 --- a/gossip-bin/src/ui/people/lists.rs +++ b/gossip-bin/src/ui/people/lists.rs @@ -54,7 +54,6 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, _frame: &mut eframe::Fra ui, app, Some(app.theme.main_content_bgcolor()), - Some(app.theme.hovered_content_bgcolor()), |ui, app| { ui.set_min_width(ui.available_width()); diff --git a/gossip-bin/src/ui/theme/default.rs b/gossip-bin/src/ui/theme/default.rs index 6b7a47cf8..85222a74a 100644 --- a/gossip-bin/src/ui/theme/default.rs +++ b/gossip-bin/src/ui/theme/default.rs @@ -142,17 +142,9 @@ impl ThemeDef for DefaultTheme { fn main_content_bgcolor(dark_mode: bool) -> Color32 { if dark_mode { - Color32::BLACK - } else { - Color32::WHITE - } - } - - fn hovered_content_bgcolor(dark_mode: bool) -> Color32 { - if dark_mode { - Self::neutral_950() + Self::neutral_800() } else { - Self::neutral_50() + Self::neutral_100() } } @@ -280,7 +272,7 @@ impl ThemeDef for DefaultTheme { // Background colors window_fill: Self::neutral_950(), // pulldown menus and tooltips - panel_fill: Color32::from_gray(0x29), // panel backgrounds, even-table-rows + panel_fill: Self::neutral_900(), // panel backgrounds, even-table-rows faint_bg_color: Color32::from_gray(20), // odd-table-rows extreme_bg_color: Color32::from_gray(45), // text input background; scrollbar background code_bg_color: Color32::from_gray(64), // ??? @@ -372,7 +364,7 @@ impl ThemeDef for DefaultTheme { // Background colors window_fill: Self::neutral_100(), // pulldown menus and tooltips - panel_fill: Color32::from_gray(0xF4), // panel backgrounds, even-table-rows + panel_fill: Self::neutral_50(), // panel backgrounds, even-table-rows faint_bg_color: Color32::from_gray(248), // odd-table-rows extreme_bg_color: Color32::from_gray(246), // text input background; scrollbar background code_bg_color: Color32::from_gray(230), // ??? diff --git a/gossip-bin/src/ui/theme/mod.rs b/gossip-bin/src/ui/theme/mod.rs index 9ee2d93a2..9bc083034 100644 --- a/gossip-bin/src/ui/theme/mod.rs +++ b/gossip-bin/src/ui/theme/mod.rs @@ -235,12 +235,6 @@ macro_rules! theme_dispatch { } } - pub fn hovered_content_bgcolor(&self) -> Color32 { - match self.variant { - $( $variant => $class::hovered_content_bgcolor(self.dark_mode), )+ - } - } - #[allow(dead_code)] pub fn highlighted_note_bgcolor(&self) -> Color32 { match self.variant { @@ -565,8 +559,6 @@ pub trait ThemeDef: Send + Sync { fn main_content_bgcolor(dark_mode: bool) -> Color32; - fn hovered_content_bgcolor(dark_mode: bool) -> Color32; - // Used as background for highlighting unread events fn highlighted_note_bgcolor(dark_mode: bool) -> Color32; diff --git a/gossip-bin/src/ui/widgets/list_entry.rs b/gossip-bin/src/ui/widgets/list_entry.rs index 175db37c2..49053ff74 100644 --- a/gossip-bin/src/ui/widgets/list_entry.rs +++ b/gossip-bin/src/ui/widgets/list_entry.rs @@ -73,22 +73,13 @@ pub(crate) fn clickable_frame( ui: &mut Ui, app: &mut GossipUi, fill: Option, - hover_fill: Option, mut content: impl FnMut(&mut Ui, &mut GossipUi) -> R, ) -> InnerResponse { // now really render the frame let frame = make_frame(ui, fill); let mut prepared = frame.begin(ui); let inner = content(&mut prepared.content_ui, app); - let response = prepared.allocate_space(ui); - - if response.hovered() { - if let Some(fill) = hover_fill { - prepared.frame.fill = fill; - } - } - - prepared.paint(ui); + let response = prepared.end(ui); InnerResponse { inner, response } } diff --git a/gossip-bin/src/ui/widgets/relay_entry.rs b/gossip-bin/src/ui/widgets/relay_entry.rs index e3369d968..bd939a4a5 100644 --- a/gossip-bin/src/ui/widgets/relay_entry.rs +++ b/gossip-bin/src/ui/widgets/relay_entry.rs @@ -206,8 +206,16 @@ impl RelayEntry { let mut hsva: ecolor::HsvaGamma = accent.into(); hsva.v *= 0.8; let accent_hover: Color32 = hsva.into(); - let bg_fill = app.theme.main_content_bgcolor(); - let bg_hover = app.theme.hovered_content_bgcolor(); + let bg_fill = if app.theme.dark_mode { + app.theme.neutral_800() + } else { + app.theme.neutral_100() + }; + let bg_hover = if app.theme.dark_mode { + app.theme.neutral_950() + } else { + app.theme.neutral_50() + }; Self { relay, view: RelayEntryView::List,