diff options
| author | Daniel Jankowski <daniel.jankowski@rub.de> | 2023-08-31 20:09:25 +0200 |
|---|---|---|
| committer | Daniel Jankowski <daniel.jankowski@rub.de> | 2023-08-31 20:09:25 +0200 |
| commit | b59cb2e0e9c6801702ae0df764fb0730d38913f7 (patch) | |
| tree | 1f22f1171bb3b242c85d38ccc3302e97fb0a5b6d /src | |
| parent | chore: rename clock to datetime (diff) | |
| download | sl0pstatus-b59cb2e0e9c6801702ae0df764fb0730d38913f7.tar.gz sl0pstatus-b59cb2e0e9c6801702ae0df764fb0730d38913f7.tar.xz sl0pstatus-b59cb2e0e9c6801702ae0df764fb0730d38913f7.zip | |
feat: add rgb hex colors
Diffstat (limited to 'src')
| -rw-r--r-- | src/config.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/config.rs b/src/config.rs index 7672f9b..6a8be00 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,6 +1,6 @@ use std::collections::BTreeMap; -use ansi_term::{Colour, Colour::Fixed}; +use ansi_term::{Colour, Colour::Fixed, Colour::RGB}; #[derive(Default)] pub struct ModuleConfig { @@ -20,8 +20,9 @@ pub struct FormattedPart { fn parse_color(color: &str) -> Option<Colour> { if color.starts_with("#") { - // TODO: render hex to color - return Some(Fixed(1)); + let rgb = hex_rgb::convert_hexcode_to_rgb(color.to_string()).unwrap(); + + return Some(RGB(rgb.red, rgb.green, rgb.blue)); } if let Ok(result) = color.parse::<u8>() { |
