Fix color style getter

This commit is contained in:
Dheepak Krishnamurthy 2021-02-11 00:08:44 -07:00
parent 633216cd91
commit 27ac07f1ed

View file

@ -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::<u8>().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::<u8>().unwrap_or_default();
Color::Indexed(c.wrapping_shl(8))
} else if s.contains("gray") {
let s = s.trim_start_matches("bright ");