mirror of
https://github.com/aljazceru/notedeck.git
synced 2025-12-19 09:34:19 +01:00
theme: refactor dark theme logic to use is_oled
This actually has no behavioral change, but is more logically correct if we ever end up updating these functions Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -10,6 +10,8 @@ pub fn setup_chrome(ctx: &egui::Context, args: ¬edeck::Args, theme: ThemePref
|
|||||||
.is_mobile
|
.is_mobile
|
||||||
.unwrap_or(notedeck::ui::is_compiled_as_mobile());
|
.unwrap_or(notedeck::ui::is_compiled_as_mobile());
|
||||||
|
|
||||||
|
let is_oled = notedeck::ui::is_oled();
|
||||||
|
|
||||||
// Some people have been running notedeck in debug, let's catch that!
|
// Some people have been running notedeck in debug, let's catch that!
|
||||||
if !args.tests && cfg!(debug_assertions) && !args.debug {
|
if !args.tests && cfg!(debug_assertions) && !args.debug {
|
||||||
println!("--- WELCOME TO DAMUS NOTEDECK! ---");
|
println!("--- WELCOME TO DAMUS NOTEDECK! ---");
|
||||||
@@ -24,7 +26,7 @@ pub fn setup_chrome(ctx: &egui::Context, args: ¬edeck::Args, theme: ThemePref
|
|||||||
info!("Loaded theme {:?} from disk", theme);
|
info!("Loaded theme {:?} from disk", theme);
|
||||||
o.theme_preference = theme;
|
o.theme_preference = theme;
|
||||||
});
|
});
|
||||||
ctx.set_visuals_of(egui::Theme::Dark, theme::dark_mode(is_mobile));
|
ctx.set_visuals_of(egui::Theme::Dark, theme::dark_mode(is_oled));
|
||||||
ctx.set_visuals_of(egui::Theme::Light, theme::light_mode());
|
ctx.set_visuals_of(egui::Theme::Light, theme::light_mode());
|
||||||
setup_cc(ctx, is_mobile);
|
setup_cc(ctx, is_mobile);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,9 +90,9 @@ pub fn light_mode() -> Visuals {
|
|||||||
notedeck::theme::create_themed_visuals(light_color_theme(), Visuals::light())
|
notedeck::theme::create_themed_visuals(light_color_theme(), Visuals::light())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn dark_mode(mobile: bool) -> Visuals {
|
pub fn dark_mode(is_oled: bool) -> Visuals {
|
||||||
notedeck::theme::create_themed_visuals(
|
notedeck::theme::create_themed_visuals(
|
||||||
if mobile {
|
if is_oled {
|
||||||
mobile_dark_color_theme()
|
mobile_dark_color_theme()
|
||||||
} else {
|
} else {
|
||||||
desktop_dark_color_theme()
|
desktop_dark_color_theme()
|
||||||
|
|||||||
Reference in New Issue
Block a user