From 27ac07f1ed900e43d02d5663c49c06416b6faabc Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Thu, 11 Feb 2021 00:08:44 -0700 Subject: [PATCH] Fix color style getter --- src/config.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config.rs b/src/config.rs index 3988a4e..8b25692 100644 --- a/src/config.rs +++ b/src/config.rs @@ -176,7 +176,7 @@ impl Config { let s = s.trim_end(); if s.contains("color") { let s = s.trim_start_matches("bright "); - let c = (s.as_bytes()[5] as char).to_digit(10).unwrap_or_default() as u8; + let c = s.trim_start_matches("color").parse::().unwrap_or_default(); Color::Indexed(c) } else if s.contains("gray") { let s = s.trim_start_matches("bright "); @@ -231,7 +231,7 @@ impl Config { let s = s.trim_end(); if s.contains("color") { let s = s.trim_start_matches("bright "); - let c = (s.as_bytes()[5] as char).to_digit(10).unwrap_or_default() as u8; + let c = s.trim_start_matches("color").parse::().unwrap_or_default(); Color::Indexed(c.wrapping_shl(8)) } else if s.contains("gray") { let s = s.trim_start_matches("bright ");