diff --git a/game/src/sandbox/mod.rs b/game/src/sandbox/mod.rs index 1117dc2f91..d9a8ffbec8 100644 --- a/game/src/sandbox/mod.rs +++ b/game/src/sandbox/mod.rs @@ -293,6 +293,7 @@ struct BackToMainMenu; impl State for BackToMainMenu { fn event(&mut self, ctx: &mut EventCtx, app: &mut App) -> Transition { + app.change_color_scheme(ctx, ColorSchemeChoice::Pregame); app.clear_everything(ctx); Transition::Clear(vec![MainMenu::new(ctx)]) } diff --git a/map_gui/src/colors.rs b/map_gui/src/colors.rs index 563f350b1d..0a527cf120 100644 --- a/map_gui/src/colors.rs +++ b/map_gui/src/colors.rs @@ -22,6 +22,7 @@ use crate::tools::{loading_tips, ColorScale}; pub enum ColorSchemeChoice { DayMode, NightMode, + Pregame, SAMGreenDay, SAMDesertDay, BAP, @@ -156,6 +157,7 @@ impl ColorScheme { let mut cs = match scheme { ColorSchemeChoice::DayMode => ColorScheme::day_mode(), ColorSchemeChoice::NightMode => ColorScheme::night_mode(), + ColorSchemeChoice::Pregame => ColorScheme::pregame(), ColorSchemeChoice::SAMGreenDay => ColorScheme::sam_green_day(), ColorSchemeChoice::SAMDesertDay => ColorScheme::sam_desert_day(), ColorSchemeChoice::BAP => ColorScheme::bap(), @@ -172,8 +174,19 @@ impl ColorScheme { cs } + fn pregame() -> ColorScheme { + let mut cs = Self::light_background(Style::pregame()); + cs.scheme = ColorSchemeChoice::Pregame; + cs + } + fn day_mode() -> ColorScheme { - let mut gui_style = Style::standard(); + let mut cs = Self::light_background(Style::light_bg()); + cs.scheme = ColorSchemeChoice::DayMode; + cs + } + + fn light_background(mut gui_style: Style) -> ColorScheme { gui_style.loading_tips = loading_tips(); ColorScheme { scheme: ColorSchemeChoice::DayMode, @@ -383,19 +396,7 @@ impl ColorScheme { // Shamelessly adapted from https://github.com/Uriopass/Egregoria fn night_mode() -> ColorScheme { let mut cs = ColorScheme::day_mode(); - - use widgetry::ButtonStyle; - cs.gui_style.panel_bg = hex("#003046").alpha(0.9); - cs.gui_style.btn_outline = ButtonStyle::btn_outline(); - cs.gui_style.btn_solid = ButtonStyle::btn_solid(); - cs.gui_style.btn_solid_floating = ButtonStyle::btn_solid_floating(); - cs.gui_style.text_fg_color = Color::WHITE; - cs.gui_style.icon_fg = Color::WHITE; - cs.gui_style.text_hotkey_color = Color::GREEN; - cs.gui_style.text_destructive_color = hex("#FF5E5E"); - - cs.gui_style.dropdown_border = Color::WHITE; - cs.gui_style.field_bg = cs.gui_style.panel_bg.shade(0.2); + cs.gui_style = widgetry::Style::dark_bg(); cs.void_background = hex("#200A24"); cs.map_background = Color::BLACK.into(); diff --git a/map_gui/src/options.rs b/map_gui/src/options.rs index 71cd655cec..df8a42196f 100644 --- a/map_gui/src/options.rs +++ b/map_gui/src/options.rs @@ -55,7 +55,7 @@ impl Options { debug_all_agents: false, traffic_signal_style: TrafficSignalStyle::BAP, - color_scheme: ColorSchemeChoice::DayMode, + color_scheme: ColorSchemeChoice::Pregame, toggle_day_night_colors: false, min_zoom_for_detail: 4.0, camera_angle: CameraAngle::TopDown, diff --git a/widgetry/src/runner.rs b/widgetry/src/runner.rs index e4d289d302..78417c7eab 100644 --- a/widgetry/src/runner.rs +++ b/widgetry/src/runner.rs @@ -258,7 +258,7 @@ pub fn run< } } - let mut style = Style::standard(); + let mut style = Style::pregame(); style.loading_tips = settings.loading_tips.unwrap_or_else(Text::new); let monitor_scale_factor = prerender_innards.monitor_scale_factor(); diff --git a/widgetry/src/style/mod.rs b/widgetry/src/style/mod.rs index 311198f80c..5a91f796e7 100644 --- a/widgetry/src/style/mod.rs +++ b/widgetry/src/style/mod.rs @@ -81,75 +81,29 @@ impl ButtonStyle { } impl Style { - pub fn standard() -> Style { - let use_legacy_day_theme = true; + pub fn light_bg() -> Style { Style { - panel_bg: if use_legacy_day_theme { - Color::grey(0.4) - } else { - Color::WHITE.alpha(0.8) - }, - field_bg: if use_legacy_day_theme { - Color::grey(0.3) - } else { - hex("#F2F2F2") - }, - dropdown_border: if use_legacy_day_theme { - Color::WHITE - } else { - hex("#4C4C4C") - }, + panel_bg: Color::WHITE.alpha(0.8), + field_bg: hex("#F2F2F2"), + dropdown_border: hex("#4C4C4C"), outline_thickness: 2.0, outline_color: Color::WHITE, loading_tips: Text::new(), - - icon_fg: if use_legacy_day_theme { - Color::WHITE - } else { - hex("#4C4C4C") - }, - - // Text - text_fg_color: if use_legacy_day_theme { - Color::WHITE - } else { - hex("#4C4C4C") - }, - text_hotkey_color: if use_legacy_day_theme { - Color::GREEN - } else { - hex("#EE702E") - }, + icon_fg: hex("#4C4C4C"), + text_fg_color: hex("#4C4C4C"), + text_hotkey_color: hex("#EE702E"), text_tooltip_color: Color::WHITE, - text_destructive_color: if use_legacy_day_theme { - hex("#EB3223") - } else { - hex("#FF5E5E") - }, - - // Buttons - btn_outline: if use_legacy_day_theme { - ButtonStyle::btn_outline() - } else { - ButtonStyle::btn_outline_dark() - }, - btn_solid: if use_legacy_day_theme { - ButtonStyle::btn_solid() - } else { - ButtonStyle { - fg: Color::WHITE, - fg_disabled: Color::WHITE.alpha(0.3), - bg: hex("#4C4C4C").alpha(0.8), - bg_hover: hex("#4C4C4C"), - bg_disabled: Color::grey(0.6), - outline: hex("#4C4C4C").alpha(0.6), - } - }, - btn_solid_floating: if use_legacy_day_theme { - ButtonStyle::btn_solid_floating() - } else { - ButtonStyle::btn_solid() + text_destructive_color: hex("#FF5E5E"), + btn_outline: ButtonStyle::btn_outline_dark(), + btn_solid: ButtonStyle { + fg: Color::WHITE, + fg_disabled: Color::WHITE.alpha(0.3), + bg: hex("#4C4C4C").alpha(0.8), + bg_hover: hex("#4C4C4C"), + bg_disabled: Color::grey(0.6), + outline: hex("#4C4C4C").alpha(0.6), }, + btn_solid_floating: ButtonStyle::btn_solid(), btn_solid_destructive: ButtonStyle { fg: hex("#F2F2F2"), fg_disabled: hex("#F2F2F2").alpha(0.3), @@ -184,6 +138,72 @@ impl Style { }, } } + + pub fn pregame() -> Style { + Style { + panel_bg: Color::grey(0.4), + field_bg: Color::grey(0.3), + dropdown_border: Color::WHITE, + outline_thickness: 2.0, + outline_color: Color::WHITE, + loading_tips: Text::new(), + icon_fg: Color::WHITE, + text_fg_color: Color::WHITE, + text_hotkey_color: Color::GREEN, + text_tooltip_color: Color::WHITE, + text_destructive_color: hex("#EB3223"), + btn_outline: ButtonStyle::btn_outline(), + btn_solid: ButtonStyle::btn_solid(), + btn_solid_floating: ButtonStyle::btn_solid_floating(), + btn_solid_destructive: ButtonStyle { + fg: hex("#F2F2F2"), + fg_disabled: hex("#F2F2F2").alpha(0.3), + bg: hex("#FF5E5E").alpha(0.8), + bg_hover: hex("#FF5E5E"), + bg_disabled: Color::grey(0.1), + outline: hex("#FF5E5E").alpha(0.6), + }, + btn_outline_destructive: ButtonStyle { + fg: hex("#FF5E5E"), + fg_disabled: hex("#FF5E5E").alpha(0.3), + bg: Color::CLEAR, + bg_hover: hex("#FF5E5E").alpha(0.1), + bg_disabled: Color::grey(0.1), + outline: hex("#FF5E5E"), + }, + btn_solid_primary: ButtonStyle { + fg: hex("#F2F2F2"), + fg_disabled: hex("#F2F2F2").alpha(0.3), + bg: hex("#EE702E").alpha(0.8), + bg_hover: hex("#EE702E"), + bg_disabled: hex("#EE702E").alpha(0.3), + outline: hex("#EE702E").alpha(0.6), + }, + btn_outline_primary: ButtonStyle { + fg: hex("#EE702E"), + fg_disabled: hex("#EE702E").alpha(0.3), + bg: Color::CLEAR, + bg_hover: hex("#EE702E").alpha(0.1), + bg_disabled: Color::grey(0.1), + outline: hex("#EE702E"), + }, + } + } + + pub fn dark_bg() -> Style { + let mut style = Self::light_bg(); + style.panel_bg = hex("#003046").alpha(0.9); + style.field_bg = style.panel_bg.shade(0.2); + style.btn_outline = ButtonStyle::btn_outline(); + style.btn_solid = ButtonStyle::btn_solid(); + style.btn_solid_floating = ButtonStyle::btn_solid_floating(); + style.text_fg_color = Color::WHITE; + style.icon_fg = Color::WHITE; + style.text_hotkey_color = Color::GREEN; + style.text_destructive_color = hex("#FF5E5E"); + style.dropdown_border = Color::WHITE; + style + } } // Convenience