Fix priority color

This commit is contained in:
Dheepak Krishnamurthy 2021-02-14 08:33:34 -07:00
parent b0faf774fd
commit ad9d31fcf7
2 changed files with 10 additions and 2 deletions

View file

@ -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);
}
}

View file

@ -313,7 +313,6 @@ impl Config {
fn get_rule_precedence_color() -> Vec<String> {
let data = Self::get_config("rule.precedence.color");
data.split(',')
.filter(|s| !s.ends_with('.'))
.map(|s| s.to_string())
.collect::<Vec<_>>()
}