Skip to content

Commit

Permalink
fix: use correct color for shadows (#70)
Browse files Browse the repository at this point in the history
Uses the same alpha value as egui's light and dark themes.
The values are explicity set instead of using the old theme's values, as
otherwise when you go from egui default dark theme to Latte it would
end up with a shadow intended for dark mode.
  • Loading branch information
lampsitter authored Nov 9, 2024
1 parent 8b56000 commit 38af073
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ fn make_widget_visual(
impl Theme {
fn visuals(&self, old: egui::Visuals) -> egui::Visuals {
let is_latte = *self == LATTE;
let shadow_color = if is_latte {
egui::Color32::from_black_alpha(25)
} else {
egui::Color32::from_black_alpha(96)
};

egui::Visuals {
override_text_color: Some(self.text),
hyperlink_color: self.rosewater,
Expand Down Expand Up @@ -127,12 +133,13 @@ impl Theme {
..old.selection.stroke
},
},

window_shadow: epaint::Shadow {
color: self.base,
color: shadow_color,
..old.window_shadow
},
popup_shadow: epaint::Shadow {
color: self.base,
color: shadow_color,
..old.popup_shadow
},
dark_mode: !is_latte,
Expand Down

0 comments on commit 38af073

Please sign in to comment.