From 22902a5889ab36303aed53c0d2fe57a3be919474 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 6 Jun 2019 11:22:30 +0530 Subject: Coloring for marked entries --- src/interactive/widgets/entries.rs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src/interactive/widgets/entries.rs') diff --git a/src/interactive/widgets/entries.rs b/src/interactive/widgets/entries.rs index f364110..5f793a0 100644 --- a/src/interactive/widgets/entries.rs +++ b/src/interactive/widgets/entries.rs @@ -1,4 +1,4 @@ -use crate::interactive::{DisplayOptions, EntryDataBundle, EntryMark}; +use crate::interactive::{DisplayOptions, EntryDataBundle, EntryMarkMap}; use dua::traverse::{Tree, TreeIndex}; use itertools::Itertools; use std::{borrow::Borrow, path::Path}; @@ -16,7 +16,7 @@ pub struct EntriesProps<'a> { pub display: DisplayOptions, pub selected: Option, pub entries: &'a [EntryDataBundle], - pub marked: &'a [EntryMark], + pub marked: &'a EntryMarkMap, pub border_style: Style, pub is_focussed: bool, } @@ -39,7 +39,7 @@ impl Entries { display, entries, selected, - marked: _, + marked, border_style, is_focussed, } = props.borrow(); @@ -131,6 +131,7 @@ impl Entries { style, ); + let dark_yellow = Color::Rgb(176, 126, 0); let name = Text::Styled( fill_background_to_right( format!( @@ -142,11 +143,16 @@ impl Entries { ) .into(), Style { - fg: match (!is_dir, exists) { - (true, true) if !is_selected => Color::DarkGray, - (true, true) => style.fg, - (_, false) => Color::Red, - (false, true) => style.fg, + fg: match (!is_dir, exists, marked.contains_key(node_idx)) { + (true, true, false) if !is_selected => Color::DarkGray, + (true, true, false) => style.fg, + (false, true, false) => style.fg, + + (true, true, true) => dark_yellow, + (false, true, true) => Color::Yellow, + + // non-existing - always red! + (_, false, _) => Color::Red, }, ..style }, -- cgit v1.2.3