From bf23e778b359f9738374c5154bd3686e8fde2b1f Mon Sep 17 00:00:00 2001 From: kernelkind Date: Wed, 17 Apr 2024 13:36:21 -0400 Subject: [PATCH] Seperate mobile dark color theme into its own func I believe this is less messy Signed-off-by: kernelkind Signed-off-by: William Casarin --- src/app_style.rs | 13 +++++++++++-- src/colors.rs | 11 +++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/app_style.rs b/src/app_style.rs index 8cca987..bca10ea 100644 --- a/src/app_style.rs +++ b/src/app_style.rs @@ -1,4 +1,6 @@ -use crate::colors::{dark_color_theme, light_color_theme, ColorTheme}; +use crate::colors::{ + desktop_dark_color_theme, light_color_theme, mobile_dark_color_theme, ColorTheme, +}; use egui::{ epaint::Shadow, style::{WidgetVisuals, Widgets}, @@ -14,7 +16,14 @@ pub fn light_mode() -> Visuals { } pub fn dark_mode(mobile: bool) -> Visuals { - create_themed_visuals(dark_color_theme(mobile), Visuals::dark()) + create_themed_visuals( + if mobile { + mobile_dark_color_theme() + } else { + desktop_dark_color_theme() + }, + Visuals::dark(), + ) } pub fn user_requested_visuals_change( diff --git a/src/colors.rs b/src/colors.rs index f65c7d9..eed5a30 100644 --- a/src/colors.rs +++ b/src/colors.rs @@ -42,10 +42,10 @@ pub struct ColorTheme { pub inactive_weak_bg_fill: Color32, } -pub fn dark_color_theme(mobile: bool) -> ColorTheme { +pub fn desktop_dark_color_theme() -> ColorTheme { ColorTheme { // VISUALS - panel_fill: if mobile { Color32::BLACK } else { DARKER_BG }, + panel_fill: DARKER_BG, extreme_bg_color: SEMI_DARKER_BG, text_color: Color32::WHITE, err_fg_color: RED_700, @@ -68,6 +68,13 @@ pub fn dark_color_theme(mobile: bool) -> ColorTheme { } } +pub fn mobile_dark_color_theme() -> ColorTheme { + ColorTheme { + panel_fill: Color32::BLACK, + ..desktop_dark_color_theme() + } +} + pub fn light_color_theme() -> ColorTheme { ColorTheme { // VISUALS