From b038468cfca54ecb68fb232aaa7e39a956d124da Mon Sep 17 00:00:00 2001 From: yuni Date: Tue, 9 Jul 2024 02:38:28 +0200 Subject: [PATCH] bevy14: upgrade Color::hex usage --- src/cmd.rs | 4 ++-- src/var.rs | 36 ++++++++++++++++++------------------ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/cmd.rs b/src/cmd.rs index 2e741e4..f863c05 100644 --- a/src/cmd.rs +++ b/src/cmd.rs @@ -609,8 +609,8 @@ pub fn load_defs(mut ew_spawn: EventWriter) { } ["light", color_hex, brightness] => { if let Ok(brightness_float) = brightness.parse::() { - if let Ok(color) = Color::hex(color_hex) { - state.light_color = Some(color); + if let Ok(color) = Srgba::hex(color_hex) { + state.light_color = Some(Color::Srgba(color)); state.light_brightness = brightness_float; } else { error!("Can't parse hexadecimal color code: {line}"); diff --git a/src/var.rs b/src/var.rs index a593c37..578d181 100644 --- a/src/var.rs +++ b/src/var.rs @@ -204,24 +204,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(COLOR_PRIMARY).unwrap(), - hud_color_fps: Color::hex("#181818").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(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(), + hud_color: Srgba::hex(COLOR_PRIMARY).unwrap().into(), + hud_color_fps: Srgba::hex("#181818").unwrap().into(), + hud_color_console: Srgba::hex(COLOR_PRIMARY).unwrap().into(), + hud_color_console_achievement: Srgba::hex(COLOR_SUCCESS).unwrap().into(), + hud_color_console_warn: Srgba::hex(COLOR_WARNING).unwrap().into(), + hud_color_console_system: Srgba::hex(COLOR_SECONDARY).unwrap().into(), + hud_color_alert: Srgba::hex(COLOR_SECONDARY).unwrap().into(), + hud_color_subtitles: Srgba::hex(COLOR_SECONDARY).unwrap().into(), + hud_color_choices: Srgba::hex(COLOR_BODY).unwrap().into(), + hud_color_speedometer: Srgba::hex(COLOR_PRIMARY).unwrap().into(), + hud_color_deathpoem: Srgba::hex("#CC2200").unwrap().into(), + hud_color_achievement: Srgba::hex(COLOR_DIM).unwrap().into(), + hud_color_achievement_accomplished: Srgba::hex(COLOR_SUCCESS).unwrap().into(), + hud_color_achievement_header: Srgba::hex(COLOR_PRIMARY).unwrap().into(), + hud_color_death: Srgba::hex(COLOR_SECONDARY).unwrap().into(), + hud_color_death_achievements: Srgba::hex(COLOR_SECONDARY).unwrap().into(), + hud_color_keybindings: Srgba::hex(COLOR_DIM).unwrap().into(), + hud_color_version: Srgba::hex(COLOR_PRIMARY).unwrap().into(), chat_speed: DEFAULT_CHAT_SPEED * if dev_mode { 2.5 } else { 1.0 }, ar_avatar: 0, flashlight_active: false,