diff options
author | Beethoven-n <44652883+Beethoven-n@users.noreply.github.com> | 2022-03-05 14:48:20 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-05 15:48:20 -0500 |
commit | a1b313bd1d94917b0677076b6591cc3bd21979f3 (patch) | |
tree | d6608dcde2367351853536531d26dbf834996d4f /src | |
parent | 575ace35a5eb3e22cdd14e02fdc10d522d098910 (diff) |
Fix for issue #151 (#154)
* (src/config/theme/style.rs) Add hex parsing
Consulted with a friend who knows Rust better than me and was able
to implement a fix for https://github.com/kamiyaa/joshuto/issues/151
pretty quickly after that point
* (src/config/theme/style.rs) Reimplement
* (src/config/theme/style.rs) Reformat
* (src/config/theme/style.rs) Add missing comma
everything told me that `cargo fmt --all -- --check` would at least tell
me about this error. what???
Diffstat (limited to 'src')
-rw-r--r-- | src/config/theme/style.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/config/theme/style.rs b/src/config/theme/style.rs index e63b988..aa91d0c 100644 --- a/src/config/theme/style.rs +++ b/src/config/theme/style.rs @@ -60,6 +60,16 @@ impl RawAppStyle { "light_cyan" => style::Color::LightCyan, "white" => style::Color::White, "reset" => style::Color::Reset, + s if s.starts_with('#') => { + let rgb = match Rgb::from_hex_str(s) { + Ok(s) => s, + _ => return style::Color::Reset, + }; + let r = rgb.get_red() as u8; + let g = rgb.get_green() as u8; + let b = rgb.get_blue() as u8; + style::Color::Rgb(r, g, b) + }, s if s.is_empty() => style::Color::Reset, s => match s.parse::<Rgb>() { Ok(rgb) => { |