diff options
Diffstat (limited to 'src/config.rs')
| -rw-r--r-- | src/config.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/config.rs b/src/config.rs index b57d67f4..ce317d33 100644 --- a/src/config.rs +++ b/src/config.rs @@ -750,11 +750,16 @@ pub struct Keybinds { } /// Parse a color string into a ratatui Color. -/// Supports: hex (#rrggbb, #rgb), named colors, rgb(r,g,b). +/// Supports: hex (#rrggbb, #rgb), named colors, rgb(r,g,b), and reset aliases. pub fn parse_color(s: &str) -> ratatui::style::Color { use ratatui::style::Color; let s = s.trim().to_lowercase(); + match s.as_str() { + "reset" | "default" | "none" | "transparent" => return Color::Reset, + _ => {} + } + // Hex: #rrggbb or #rgb if let Some(hex) = s.strip_prefix('#') { if hex.len() == 6 { @@ -1481,6 +1486,15 @@ name = "dracula" } #[test] + fn parse_color_accepts_reset_aliases() { + use ratatui::style::Color; + + for value in ["reset", "default", "none", "transparent"] { + assert_eq!(parse_color(value), Color::Reset, "value: {value}"); + } + } + + #[test] fn theme_custom_overrides_parse() { let toml = r##" [theme] |
