Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix styling for entries for interactive mode#62

Merged
Byron merged 2 commits into
Byron:masterfrom
Mephistophiles:master
Jul 24, 2020
Merged

Fix styling for entries for interactive mode#62
Byron merged 2 commits into
Byron:masterfrom
Mephistophiles:master

Conversation

@Mephistophiles
Copy link
Copy Markdown
Contributor

This changeset replaced colors for entries in interactive mode
directory: from none to cyan
regular file: from dark gray to none

Before:
before

After:
after

@Byron Byron merged commit 2cc6916 into Byron:master Jul 24, 2020
@Byron
Copy link
Copy Markdown
Owner

Byron commented Jul 24, 2020

Thanks a lot! Much appreciated!

I do wonder though why dimmed grey simply won't display for you - is it 'unsafe' to ever use it in TUIs?

@Byron
Copy link
Copy Markdown
Owner

Byron commented Jul 24, 2020

Version 2.10.1 was released.

@Mephistophiles
Copy link
Copy Markdown
Contributor Author

I do wonder though why dimmed grey simply won't display for you - is it 'unsafe' to ever use it in TUIs?

Hmmmm...
I'm not а UI master =). But I have compared different terminal color schemes (ok/not ok for me):

  • OK:

    • Material
      material
    • Monokai Dark
      monokai_dark
    • Solarized Light
      solarized_light
  • NOT OK:

    • Linux
      linux
    • Orchis
      orchis
    • Solarized dark
      solarized_dark
    • Tango
      tango
    • Yaru
      yaru
    • Base16
      base16

@Byron
Copy link
Copy Markdown
Owner

Byron commented Jul 25, 2020

I am amazed by the effort you put into this reply, very neat to look at - thank you!

This makes it easier for me to get used to the different color, too, as I now see that the contrast is too low in many color themes.
Personally I am still using the previous release, but CYAN is the way to go!

@shilangyu
Copy link
Copy Markdown

shilangyu commented Jul 26, 2020

On a similar note: the files are often not visible in the cli version as well.

image

Using a semi-transparent background

@Mephistophiles
Copy link
Copy Markdown
Contributor Author

@shilangyu try this patch

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 {

@shilangyu
Copy link
Copy Markdown

Would it be worth adding it to dua? Would maintain consistency between the cli and tui

@Mephistophiles
Copy link
Copy Markdown
Contributor Author

PR #63 was created

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants