theme: persist across app close
Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user