eza-community / eza

A modern alternative to ls
https://eza.rocks
European Union Public License 1.2
11.8k stars 211 forks source link

feat: Custom colors for file categories #235

Closed ghost closed 1 year ago

ghost commented 1 year ago

Request the ability to change colors for file categories — e.g. immediate, document, image, etc. If this feature already exists I have not been able to find it in the documentation.

Currently if you want, for instance, to change the immediate file color, you would have to separately specify it for 41 different filenames — and you would have to make changes every time a new immediate file is added.

For those of us who prefer light background, yellow is a terrible, unreadable color, and changing it individually for every immediate file is a pain.

eggbean commented 1 year ago

exa/eza uses the $LS_COLORS variable, so you can change the colours for any file with a dir_colors file which is used to set that variable.

eg.

.md 01;32

This will change all files with the .md extension to green (dependent on your terminal ANSI theme), but you an also use the 256 colour range or probably even 24-bit colours by now (I don't have any desire to even look into that for $LS_COLORS).

Or you can set a colour just for files called README.md like this:

*README.md 01;32

This is the current state of my dir_colors file as an example (forget the version number, as I never updated it) http://ix.io/4FQP

$ man dircolors

https://www.baeldung.com/linux/ls-output-color-files-directories

ghost commented 1 year ago

I think you missed my point. Yes, you can do that, but you have to do it for each individual file name or type in the category that gets the undesired color, and you have to update your configuration any time a new addition is made to that category. What I would like is a single code to change the color for all files of that category.

eggbean commented 1 year ago

There's also the $EXA_COLORS variable which overrides $LS_COLORS and has some "categories", but I cannot find the keys for them - you'll have to look at the source code.

https://the.exa.website/features/colours https://the.exa.website/docs/colour-themes

But I stopped using $EXA_COLORS early on for files (only use it to change the colours of exa elements) as these "categories" don't include all filetypes you may come across, as this is something that continuously changes. There were many cryptography filetypes that were missing, which led me to just use dircolors, which is completely flexible, extensible and granular.

I've added quite a lot of filetypes to my already quite lengthy dircolors file - most recently .bz3 and I'll probably add .bz4 one day. The time taken for all the additions and changes using vim over the years has taken less time than this conversation.

Terraphice commented 1 year ago

Frankly it's archaic to rely on the user specifying colors for each individual file type in an ENV.

The ability to write, share, and import themes is basic functionality for most modern CLI programs that heavily involve text. (Think bat.)

+1

PThorpe92 commented 1 year ago

The ability to write, share, and import themes is basic functionality for most modern CLI programs that heavily involve text. (Think bat.)

Yeah this was some of the thought process behind https://github.com/eza-community/eza/issues/139 Hopefully after some of the bigger changes going on and features like the PR to close the issue are added :+1:

Terraphice commented 1 year ago

Yeah this was some of the thought process behind #139 Hopefully after some of the bigger changes going on and features like the PR to close the issue are added 👍

Yeah, I used to use LSD on my Windows devices as an alternative to a MSYS Exa install, and this was definitely one of the larger parts of it that I missed.