From d1a906b487b062877166d701e34dc35720412ec3 Mon Sep 17 00:00:00 2001 From: hut Date: Tue, 14 May 2024 23:00:55 +0200 Subject: [PATCH] remove more redundancy (add "color scheme") --- src/common.rs | 8 ++++++++ src/var.rs | 32 ++++++++++++++++---------------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/common.rs b/src/common.rs index 53195f7..bca26c8 100644 --- a/src/common.rs +++ b/src/common.rs @@ -24,6 +24,14 @@ pub const FONT: &str = "fonts/Yupiter-Regular.ttf"; pub const EPSILON32: f32 = 1e-9; pub const EPSILON: f64 = 1e-9; +pub const COLOR_BODY: &str = "#888888"; // For simple text +pub const COLOR_DIM: &str = "#666666"; // For darker, less important text +pub const COLOR_PRIMARY: &str = "#BE1251"; // The "branding" color +pub const COLOR_SECONDARY: &str = "#CCCCCC"; // For accents +pub const COLOR_SUCCESS: &str = "#F0D50C"; // For positive outcomes +pub const COLOR_DANGER: &str = "#CCCCCC"; // For critical situations +pub const COLOR_WARNING: &str = "#F0D50C"; // For warnings + #[inline] pub fn bool2vis(boolean: bool) -> Visibility { if boolean { diff --git a/src/var.rs b/src/var.rs index 7ab62a0..7c8e424 100644 --- a/src/var.rs +++ b/src/var.rs @@ -187,24 +187,24 @@ impl Default for Settings { font_size_achievement_header: 32.0, font_size_keybindings: 20.0, font_size_version: 20.0, - hud_color: Color::hex("#BE1251").unwrap(), + hud_color: Color::hex(COLOR_PRIMARY).unwrap(), hud_color_fps: Color::hex("#181818").unwrap(), - hud_color_console: Color::hex("#BE1251").unwrap(), - hud_color_console_achievement: Color::hex("#F0D50C").unwrap(), - hud_color_console_warn: Color::hex("#CCCCCC").unwrap(), - hud_color_console_system: Color::hex("#7F7F7F").unwrap(), - hud_color_alert: Color::hex("#CCCCCC").unwrap(), - hud_color_subtitles: Color::hex("#CCCCCC").unwrap(), - hud_color_choices: Color::hex("#727272").unwrap(), - hud_color_speedometer: Color::hex("#BE1251").unwrap(), + hud_color_console: Color::hex(COLOR_PRIMARY).unwrap(), + hud_color_console_achievement: Color::hex(COLOR_SUCCESS).unwrap(), + hud_color_console_warn: Color::hex(COLOR_WARNING).unwrap(), + hud_color_console_system: Color::hex(COLOR_SECONDARY).unwrap(), + hud_color_alert: Color::hex(COLOR_SECONDARY).unwrap(), + hud_color_subtitles: Color::hex(COLOR_SECONDARY).unwrap(), + hud_color_choices: Color::hex(COLOR_BODY).unwrap(), + hud_color_speedometer: Color::hex(COLOR_PRIMARY).unwrap(), hud_color_deathpoem: Color::hex("#CC2200").unwrap(), - hud_color_achievement: Color::hex("#666666").unwrap(), - hud_color_achievement_accomplished: Color::hex("#F0D50C").unwrap(), - hud_color_achievement_header: Color::hex("#BE1251").unwrap(), - hud_color_death: Color::hex("#CCCCCC").unwrap(), - hud_color_death_achievements: Color::hex("#CCCCCC").unwrap(), - hud_color_keybindings: Color::hex("#666666").unwrap(), - hud_color_version: Color::hex("#BE1251").unwrap(), + hud_color_achievement: Color::hex(COLOR_DIM).unwrap(), + hud_color_achievement_accomplished: Color::hex(COLOR_SUCCESS).unwrap(), + hud_color_achievement_header: Color::hex(COLOR_PRIMARY).unwrap(), + hud_color_death: Color::hex(COLOR_SECONDARY).unwrap(), + hud_color_death_achievements: Color::hex(COLOR_SECONDARY).unwrap(), + hud_color_keybindings: Color::hex(COLOR_DIM).unwrap(), + hud_color_version: Color::hex(COLOR_PRIMARY).unwrap(), chat_speed: DEFAULT_CHAT_SPEED * if dev_mode { 2.5 } else { 1.0 }, flashlight_active: false, hud_active: true,