Skip to content

Commit

Permalink
Revert "Default Theme: Adjust Panel colors and all clickable_frame() …
Browse files Browse the repository at this point in the history
…bacckground colors"

This reverts commit 3b7f5db.
  • Loading branch information
mikedilger committed Nov 7, 2024
1 parent d9c8607 commit 6b9e08e
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 37 deletions.
1 change: 0 additions & 1 deletion gossip-bin/src/ui/dm_chat_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions gossip-bin/src/ui/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down Expand Up @@ -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());

Expand Down
1 change: 0 additions & 1 deletion gossip-bin/src/ui/people/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion gossip-bin/src/ui/people/lists.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
16 changes: 4 additions & 12 deletions gossip-bin/src/ui/theme/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down Expand Up @@ -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), // ???
Expand Down Expand Up @@ -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), // ???
Expand Down
8 changes: 0 additions & 8 deletions gossip-bin/src/ui/theme/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;

Expand Down
11 changes: 1 addition & 10 deletions gossip-bin/src/ui/widgets/list_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,13 @@ pub(crate) fn clickable_frame<R>(
ui: &mut Ui,
app: &mut GossipUi,
fill: Option<Color32>,
hover_fill: Option<Color32>,
mut content: impl FnMut(&mut Ui, &mut GossipUi) -> R,
) -> InnerResponse<R> {
// 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 }
}
Expand Down
12 changes: 10 additions & 2 deletions gossip-bin/src/ui/widgets/relay_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 6b9e08e

Please sign in to comment.