From ad9d31fcf7a569921347b8e08da41df241fcc182 Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Sun, 14 Feb 2021 08:33:34 -0700 Subject: [PATCH] Fix priority color --- src/app.rs | 11 ++++++++++- src/config.rs | 1 - 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/app.rs b/src/app.rs index 892690a..8f543c4 100644 --- a/src/app.rs +++ b/src/app.rs @@ -566,6 +566,15 @@ impl TTApp { let mut style = Style::default(); for tag_name in virtual_tag_names_in_precedence.iter().rev() { + if tag_name == "uda." { + if let Some(p) = task.priority() { + let c = self.config.color.get(&format!("color.{}priority.{}", tag_name, p)).cloned().unwrap_or_default(); + style = style.fg(c.fg).bg(c.bg); + for modifier in c.modifiers { + style = style.add_modifier(modifier); + } + } + } if task .tags() .unwrap_or(&vec![]) @@ -1691,7 +1700,7 @@ mod tests { let app = TTApp::new(); match app { Ok(app) => { - if let Some(task) = app.task_by_id(27) { + if let Some(task) = app.task_by_id(1) { let style = app.style_for_task(&task); } } diff --git a/src/config.rs b/src/config.rs index 1d83429..a30a732 100644 --- a/src/config.rs +++ b/src/config.rs @@ -313,7 +313,6 @@ impl Config { fn get_rule_precedence_color() -> Vec { let data = Self::get_config("rule.precedence.color"); data.split(',') - .filter(|s| !s.ends_with('.')) .map(|s| s.to_string()) .collect::>() }