summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxim Zhukov <mussitantesmortem@gmail.com>2020-07-27 13:02:45 +0300
committerMaxim Zhukov <mussitantesmortem@gmail.com>2020-07-27 13:40:24 +0300
commit4d2e83904fd66a3d480b5f50ad6fa2192d113a3f (patch)
treec7332a52e3be0cdb9f2c012a891fd1dc6559170a
parent31c588eaf30f34f2df23c3cc28ee8aebe5a01ca0 (diff)
src, aggregate: fix colors for aggregate mode
Use Cyan for folders in aggregate mode Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com>
-rw-r--r--src/aggregate.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/aggregate.rs b/src/aggregate.rs
index 044f8e0..45df81a 100644
--- a/src/aggregate.rs
+++ b/src/aggregate.rs
@@ -111,9 +111,17 @@ pub fn aggregate(
fn path_color_of(path: impl AsRef<Path>) -> Option<Color> {
if path.as_ref().is_file() {
- Some(Color::BrightBlack)
- } else {
None
+ } else {
+ Some(Color::Cyan)
+ }
+}
+
+fn colorize_path(path: &Path, path_color: Option<colored::Color>) -> colored::ColoredString {
+ if let Some(path_color) = path_color {
+ path.display().to_string().as_str().color(path_color)
+ } else {
+ path.display().to_string().as_str().normal()
}
}
@@ -134,11 +142,7 @@ fn output_colored_path(
.to_string()
.as_str()
.green(),
- path.as_ref()
- .display()
- .to_string()
- .as_str()
- .color(path_color.unwrap_or(Color::White)),
+ colorize_path(path.as_ref(), path_color),
if num_errors == 0 {
Cow::Borrowed("")
} else {