theme: persist across app close

Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
kernelkind
2024-12-11 13:59:34 -05:00
parent 2ce845c1fc
commit 9e67f9dc8c
5 changed files with 137 additions and 35 deletions

View File

@@ -6,7 +6,7 @@ use crate::{
use egui::{
epaint::Shadow,
style::{Interaction, Selection, WidgetVisuals, Widgets},
Button, FontFamily, FontId, Rounding, Stroke, Style, TextStyle, Ui, Visuals,
FontFamily, FontId, Rounding, Stroke, Style, TextStyle, Visuals,
};
use strum::IntoEnumIterator;
use strum_macros::EnumIter;
@@ -28,29 +28,6 @@ pub fn dark_mode(mobile: bool) -> Visuals {
)
}
pub fn user_requested_visuals_change(
oled: bool,
cur_darkmode: bool,
ui: &mut Ui,
) -> Option<Visuals> {
if cur_darkmode {
if ui
.add(Button::new("").frame(false))
.on_hover_text("Switch to light mode")
.clicked()
{
return Some(light_mode());
}
} else if ui
.add(Button::new("🌙").frame(false))
.on_hover_text("Switch to dark mode")
.clicked()
{
return Some(dark_mode(oled));
}
None
}
/// Create custom text sizes for any FontSizes
pub fn add_custom_style(is_mobile: bool, style: &mut Style) {
let font_size = if is_mobile {