sxyazi / yazi

💥 Blazing fast terminal file manager written in Rust, based on async I/O.
https://yazi-rs.github.io
MIT License
16.35k stars 378 forks source link

[Feature request] Color/Shade gradient for linemode information #1011

Closed freijon closed 6 months ago

freijon commented 6 months ago

Please describe the problem you're trying to solve

It's not visible on first glance how the files vary in terms of size, modification date, etc. Especially with the human readable file size (which I like generally) it's harder to detect the big files without sorting by size

Would you be willing to contribute this feature?

Describe the solution you'd like

When displaying the linemode, it could be rendered with a color/shading gradient. For simplicity, it could apply the gradient to max/min of the current folder. Example:

There could be an option to enable/disable this behavior. If disabled, display like today.

It would increase the readability a lot in my opinion. Like this you can still sort alphabetically but big/small new/old files would stand out.

Additional context

No response

sxyazi commented 6 months ago

Could you describe the implementation details in more detail please?

Yazi's default theme uses 16 colors to better fit the terminal theme's color scheme. I'm not sure how to express this gradient effect.

freijon commented 6 months ago

Well, I'm no expert, but I'm thinking about something like this, but the gradient could use colors from theme.toml, for example a gradient from darkgray to gray

sxyazi commented 6 months ago

I quickly checked out the code for this crate, and it seems to use 256 colors based on RGB/HSL.

I don't know much about colors, but from my experience, it's usually best to steer clear of 256 colors when you're not sure about the user's terminal color scheme (like whether it's white text on black background or vice versa). It often leads to poor visibility.

So, my suggestion is to pick a few colors that suit your terminal and implement it yourself by overriding the Folder:linemode() method, and you can set the foreground and background colors of text respectively through Span's fg() and bg() methods.

github-actions[bot] commented 5 months ago

I'm going to lock this issue because it has been closed for 30 days. ⏳ This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.