From b4a2e0ee8f267ee50f92433e826fa9e42ff618db Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 8 Jun 2019 05:00:01 +0530 Subject: Pune/India: more prominent selection in mark pane --- src/interactive/widgets/entries.rs | 6 ++++-- src/interactive/widgets/mark.rs | 37 ++++++++++++++++++++++++++----------- src/interactive/widgets/mod.rs | 1 + 3 files changed, 31 insertions(+), 13 deletions(-) (limited to 'src/interactive/widgets') diff --git a/src/interactive/widgets/entries.rs b/src/interactive/widgets/entries.rs index db510de..cde0e5b 100644 --- a/src/interactive/widgets/entries.rs +++ b/src/interactive/widgets/entries.rs @@ -1,5 +1,7 @@ use crate::interactive::{ - widgets::{EntryMarkMap, COLOR_MARKED, COLOR_MARKED_DARK, COLOR_MARKED_DARKER}, + widgets::{ + EntryMarkMap, COLOR_BYTESIZE_SELECTED, COLOR_MARKED, COLOR_MARKED_DARK, COLOR_MARKED_DARKER, + }, DisplayOptions, EntryDataBundle, }; use dua::traverse::{Tree, TreeIndex}; @@ -118,7 +120,7 @@ impl Entries { .into(), Style { fg: match (is_selected, *is_focussed) { - (true, true) => Color::DarkGray, + (true, true) => COLOR_BYTESIZE_SELECTED, (true, false) => Color::Black, _ => Color::Green, }, diff --git a/src/interactive/widgets/mark.rs b/src/interactive/widgets/mark.rs index 5f0255d..ec115cf 100644 --- a/src/interactive/widgets/mark.rs +++ b/src/interactive/widgets/mark.rs @@ -1,5 +1,6 @@ -use crate::interactive::{ - fit_string_graphemes_with_ellipsis, widgets::COLOR_MARKED_LIGHT, CursorDirection, +use crate::{ + interactive::widgets::{COLOR_BYTESIZE_SELECTED, COLOR_MARKED_LIGHT}, + interactive::{fit_string_graphemes_with_ellipsis, CursorDirection}, }; use dua::{ path_of, @@ -146,9 +147,15 @@ impl MarkPane { .sorted_by_key(|v| &v.index) .enumerate() .map(|(idx, v)| { - let modifier = match selected { - Some(selected) if idx == selected => Modifier::BOLD, - _ => Modifier::empty(), + let (default_style, is_selected) = match selected { + Some(selected) if idx == selected => ( + Style { + bg: Color::White, + ..Default::default() + }, + true, + ), + _ => (Style::default(), false), }; let (path, path_len) = { let path = format!(" {} ", v.path.display()); @@ -168,9 +175,12 @@ impl MarkPane { let path = Text::Styled( path.into(), Style { - fg: COLOR_MARKED_LIGHT, - modifier, - ..Style::default() + fg: if is_selected { + Color::Black + } else { + COLOR_MARKED_LIGHT + }, + ..default_style }, ); let bytes = Text::Styled( @@ -181,11 +191,15 @@ impl MarkPane { ) .into(), Style { - fg: Color::Green, - ..Default::default() + fg: if is_selected { + COLOR_BYTESIZE_SELECTED + } else { + Color::Green + }, + ..default_style }, ); - let spacer = Text::Raw( + let spacer = Text::Styled( format!( "{:-space$}", "", @@ -194,6 +208,7 @@ impl MarkPane { .saturating_sub(format.total_width()) ) .into(), + default_style, ); vec![path, spacer, bytes] }); diff --git a/src/interactive/widgets/mod.rs b/src/interactive/widgets/mod.rs index ce3bdae..ee6f34c 100644 --- a/src/interactive/widgets/mod.rs +++ b/src/interactive/widgets/mod.rs @@ -14,6 +14,7 @@ pub use mark::*; use tui::style::Color; +pub const COLOR_BYTESIZE_SELECTED: Color = Color::DarkGray; pub const COLOR_MARKED: Color = Color::Yellow; pub const COLOR_MARKED_LIGHT: Color = Color::LightYellow; pub const COLOR_MARKED_DARK: Color = Color::Rgb(176, 126, 0); -- cgit v1.2.3