exa icon indicating copy to clipboard operation
exa copied to clipboard

Add color themes, similar to bat

Open mouse07410 opened this issue 3 years ago • 16 comments

Problem

Current exa 0.10.1 offers a pre-defined set of colors for the output, which works very well on terminals with black/dark background.

This color set is inconvenient in the extreme when used on terminals with light (e.g., gray) background. The provided alternative of manually setting every individual color for every possible type of file is better than nothing - but highly taxing for a user that's not an expert in these things, and merely wants different file types to show prominently on his terminal.

Proposal

Other apps, such as bat, face similar problem of coloring the output, not knowing what background user's terminal would have.

I'm asking exa developers to follow bat example, and offer the ability to choose color set from a group of sets, such as "Dark", "Light", etc.

For example, here's the set of options that bat allows. I'm not asking that exa supports all of them, but at least one option for terminals with light background, and the current color combination that's looking very good on terminals with black background, would be great:

Screen Shot 2021-10-16 at 22 06 58

(and a complete list of provided color themes)

$ bat --list-themes
Theme: 1337

  // Output the square of a number.
  fn print_square(num: f64) {
      let result = f64::powf(num, 2.0);
      println!("The square of {:.2} is {:.2}.", num, result);
  }

Theme: Coldark-Cold

  // Output the square of a number.
  fn print_square(num: f64) {
      let result = f64::powf(num, 2.0);
      println!("The square of {:.2} is {:.2}.", num, result);
  }

Theme: Coldark-Dark

  // Output the square of a number.
  fn print_square(num: f64) {
      let result = f64::powf(num, 2.0);
      println!("The square of {:.2} is {:.2}.", num, result);
  }

Theme: DarkNeon

  // Output the square of a number.
  fn print_square(num: f64) {
      let result = f64::powf(num, 2.0);
      println!("The square of {:.2} is {:.2}.", num, result);
  }

Theme: Dracula

  // Output the square of a number.
  fn print_square(num: f64) {
      let result = f64::powf(num, 2.0);
      println!("The square of {:.2} is {:.2}.", num, result);
  }

Theme: GitHub

  // Output the square of a number.
  fn print_square(num: f64) {
      let result = f64::powf(num, 2.0);
      println!("The square of {:.2} is {:.2}.", num, result);
  }

Theme: Monokai Extended

  // Output the square of a number.
  fn print_square(num: f64) {
      let result = f64::powf(num, 2.0);
      println!("The square of {:.2} is {:.2}.", num, result);
  }

Theme: Monokai Extended Bright

  // Output the square of a number.
  fn print_square(num: f64) {
      let result = f64::powf(num, 2.0);
      println!("The square of {:.2} is {:.2}.", num, result);
  }

Theme: Monokai Extended Light

  // Output the square of a number.
  fn print_square(num: f64) {
      let result = f64::powf(num, 2.0);
      println!("The square of {:.2} is {:.2}.", num, result);
  }

Theme: Monokai Extended Origin

  // Output the square of a number.
  fn print_square(num: f64) {
      let result = f64::powf(num, 2.0);
      println!("The square of {:.2} is {:.2}.", num, result);
  }

Theme: Nord

  // Output the square of a number.
  fn print_square(num: f64) {
      let result = f64::powf(num, 2.0);
      println!("The square of {:.2} is {:.2}.", num, result);
  }

Theme: OneHalfDark

  // Output the square of a number.
  fn print_square(num: f64) {
      let result = f64::powf(num, 2.0);
      println!("The square of {:.2} is {:.2}.", num, result);
  }

Theme: OneHalfLight

  // Output the square of a number.
  fn print_square(num: f64) {
      let result = f64::powf(num, 2.0);
      println!("The square of {:.2} is {:.2}.", num, result);
  }

Theme: Solarized (dark)

  // Output the square of a number.
  fn print_square(num: f64) {
      let result = f64::powf(num, 2.0);
      println!("The square of {:.2} is {:.2}.", num, result);
  }

Theme: Solarized (light)

  // Output the square of a number.
  fn print_square(num: f64) {
      let result = f64::powf(num, 2.0);
      println!("The square of {:.2} is {:.2}.", num, result);
  }

Theme: Sublime Snazzy

  // Output the square of a number.
  fn print_square(num: f64) {
      let result = f64::powf(num, 2.0);
      println!("The square of {:.2} is {:.2}.", num, result);
  }

Theme: TwoDark

  // Output the square of a number.
  fn print_square(num: f64) {
      let result = f64::powf(num, 2.0);
      println!("The square of {:.2} is {:.2}.", num, result);
  }

Theme: ansi

  // Output the square of a number.
  fn print_square(num: f64) {
      let result = f64::powf(num, 2.0);
      println!("The square of {:.2} is {:.2}.", num, result);
  }

Theme: base16

  // Output the square of a number.
  fn print_square(num: f64) {
      let result = f64::powf(num, 2.0);
      println!("The square of {:.2} is {:.2}.", num, result);
  }

Theme: base16-256

  // Output the square of a number.
  fn print_square(num: f64) {
      let result = f64::powf(num, 2.0);
      println!("The square of {:.2} is {:.2}.", num, result);
  }

Theme: gruvbox-dark

  // Output the square of a number.
  fn print_square(num: f64) {
      let result = f64::powf(num, 2.0);
      println!("The square of {:.2} is {:.2}.", num, result);
  }

Theme: gruvbox-light

  // Output the square of a number.
  fn print_square(num: f64) {
      let result = f64::powf(num, 2.0);
      println!("The square of {:.2} is {:.2}.", num, result);
  }

Theme: zenburn

  // Output the square of a number.
  fn print_square(num: f64) {
      let result = f64::powf(num, 2.0);
      println!("The square of {:.2} is {:.2}.", num, result);
  }

Further themes can be installed to '/Users/ur20980/.config/bat/themes', and are added to the cache with `bat cache --build`. For more information, see:

  https://github.com/sharkdp/bat#adding-new-themes

mouse07410 avatar Oct 17 '21 02:10 mouse07410

The provided alternative of manually setting every individual color for every possible type of file is better than nothing - but highly taxing for a user that's not an expert in these things, and merely wants different file types to show prominently on his terminal

Have you looked at configuring LS_COLORS for configuring colors for different file types? For example, https://github.com/trapd00r/LS_COLORS.

brianrobt avatar Oct 23 '21 13:10 brianrobt

I haven't - thanks for the pointer. Regardless, LS_COLORS (as I understand it) does not address my need or this feature request.

  1. I have different types of terminals - they require different settings.
  2. I want the ability to select what color scheme the output of a particular invocation would follow.
  3. Configuring LS_COLORS for "dynamic" environment doesn't appear to be trivial, and I'm trying to simplify user's experience, not make him a master of yet another complicated tool (and if you consider programming in Perl simple - we disagree strongly).

Again, what bat does is ideal for my use case, and I'd like to see something similar in exa.

mouse07410 avatar Oct 23 '21 14:10 mouse07410

Well, we disagree there. It took me ten minutes to learn how to read/write the LSCOLORS environment variable. I don't think it's complicated. Plus, there are tons of examples and prefigured LSCOLORS to choose from out there if you're lazy like me.

I have different types of terminals - they require different settings.

If you want to use multiple terminals on the same machine and user, then LSCOLORS would probably not work for you like you said.

brianrobt avatar Oct 24 '21 09:10 brianrobt

If you want to use multiple terminals on the same machine and user, then LSCOLORS would probably not work for you like you said.

This is the whole point.

Which is why I'm asking for something like --color-theme= feature.

mouse07410 avatar Oct 24 '21 12:10 mouse07410

vivid theme for LS_COLORS is quite easy to use

https://github.com/sharkdp/vivid

haifengkao avatar Jan 25 '22 12:01 haifengkao

@haifengkao I already explained why LS_COLORS does not work for my use case. Thank you for not being attentive.

mouse07410 avatar Jan 25 '22 17:01 mouse07410

You also need to change $EXA_COLORS to change all the elements of exa's long listing. But once you have spent some time defining that to how you like, there is nothing more you need to do. Everything can be made to be however you like it to be. If you don't want to do that, you can try to find somebody else who has.

I've changed mine to suit my preferences, but it's for a dark background.

https://man.archlinux.org/man/community/exa/exa_colors.5.en

eggbean avatar Jan 25 '22 18:01 eggbean

Sorry, I don't think you understood. My environment is dynamic. That makes playing with environment var settings less than desirable.

mouse07410 avatar Jan 25 '22 19:01 mouse07410

@mouse07410 I don't understand what is dynamic environment.

LS_COLORS="$(vivid generate molokai)";exa -la
LS_COLORS="$(vivid generate snazzy)";exa -la
LS_COLORS="$(vivid generate nord)";exa -la

You can use any themes you like. Just create an alias and you are all set.

haifengkao avatar Jan 26 '22 11:01 haifengkao

Dynamic - on the same computer same user on different terminals/windows needs different color schemes.

What you proposed with vivid may work. Manually setting all the colors for every alias is probably too taxing to consider as a solution, as my users don't want to mess with specifying RGB schemes at all (I agree with them).

mouse07410 avatar Jan 26 '22 14:01 mouse07410

Making a bash script that does this would take ten minutes. Having such themes in exa isn't likely to be something anyone else would be interested in.

eggbean avatar Jan 26 '22 16:01 eggbean

@mouse07410 You overestimate your problem. There is no difference between "exa supports color themes" and "you write a bash function to wrap exa and vivid together.

haifengkao avatar Jan 27 '22 03:01 haifengkao

@mouse07410 your proposed solution also wouldn't work for "dynamic" workspace, i.e. on the same computer same user on different terminals/windows needs different color schemes. User would still have to manually set the theme via --theme every time.

And if you're saying that's ok, then I don't see a reason why LS_COLORS="$(vivid generate molokai)" isn't also ok. It's the same amount of manual work...

jeanlucthumm avatar Jul 01 '23 17:07 jeanlucthumm

I must say the snark on display in this thread is disheartening.

I personally like the proposal, not because it is less work for the user, but simply because it feels nice and clean. Unfortunately, @mouse07410's attitude towards everyone that has objected to it is off-putting in the extreme and sours the whole enterprise.

Can't we all just get along? 🎸 ☮️ ✌️

cohml avatar Jul 23 '23 03:07 cohml