dtolnay/cargo-expand

Default theme unreadable on a white-background terminal

glandium opened this issue · 4 comments

The default theme seems to be using an explicit white color for normal text, which doesn't play well with non-black-background terminal windows.
Screenshot from 2021-03-30 08-43-38

The ansi theme, however, doesn't seem to be using explicit colors for normal text, and is readable with both white-background and black-background.
Screenshot from 2021-03-30 08-44-23
Screenshot from 2021-03-30 08-44-48

We don't have a default theme as far as I know. It's just whatever bat does. I think this relates to https://github.com/sharkdp/bat#highlighting-theme:

bat looks good on a dark background by default. However, if your terminal uses a light background, some themes like GitHub or OneHalfLight will work better for you.

If someone else was confused because they thought cargo expand falls back to bat's settings: cargo-expand does not pick up bat's settings. That is, if you want to have cargo-expand match this bat theme:

# $XDG_CONFIG_HOME/bat/config
--theme="Solarized (light)"

Then you need to set the following for cargo-expand:

# $CARGO_HOME/bat/config
theme = "Solarized (light)"
vi commented

~/.cargo/bat/config is theme = "Solarized (light)", but cargo-expand 1.0.16 still renders white text on white background.

Workaround: --color=always --theme 'Solarized (light)' CLI arguments.

The theme works for me after adding the following to the ~/.cargo/config file (not ~/.cargo/bat/config):

[expand]
theme="Solarized (light)"