dandavison / delta

A syntax-highlighting pager for git, diff, grep, and blame output
https://dandavison.github.io/delta/
MIT License
21.31k stars 357 forks source link

🐛 Always using light theme on dark background #1663

Open EbonJaeger opened 3 months ago

EbonJaeger commented 3 months ago

After updating to the 0.17.0 release, I can no longer read git diffs due to delta using a light theme on my dark terminal background.

My setup consists of Alacritty with Zellij and Fish. I tested on a stock GNOME Terminal as well with un-modified bash, and the problem happens there, as well. My .gitconfig options for diffing matches that in the Delta readme.

image

dandavison commented 3 months ago

Hi @EbonJaeger, sorry about that. Please add dark = true or --dark to your delta config / invocations to force colors for dark backgrounds.

delta in 0.17.0 should autodetect in the absence of the light/dark setting. I wonder if it could be an issue with Zellij cc @bash -- any thoughts?

rsmmr commented 3 months ago

I'm seeing the same issue but only when I'm inside a tmux shell. Outside tmux it works fine.

bash commented 3 months ago

Hi @EbonJaeger :wave: Thank you for reporting the bug! In your GNOME Terminal setup, are you running Bash inside of Zellij or directly in GNOME Terminal?

I would be surprised if the issue happened in GNOME Terminal directly as it has always correctly reported colors in my experience.

@dandavison From a quick glance and some preliminary tests it does seem like Zellij reports incorrect colors (happens to me both in Alacritty and GNOME Terminal). If will try to dig further next week or so.

bash commented 3 months ago

@rsmmr What version of tmux are you running? Color detection should work OK in the latest version from git iirc.

EbonJaeger commented 3 months ago

@bash I was not using Zellij or tmux in GNOME terminal; just straight Bash. I'll try the workaround later. 😃

EbonJaeger commented 3 months ago

I tried again with GNOME terminal this morning and it is working as expected. Maybe I didn't start a new session or something last night after trying to force the dark theme. Sorry about that. So that just leaves Zellij.

The workaround of setting dark = true in the .gitconfig works, though! Thanks!

bash commented 3 months ago

That's great to hear! I was worried there for a second since GNOME Terminal always worked well in my experience 😆

lilyball commented 3 months ago

I've hit this too. It works fine in tmux, but not in zellij. What's more annoying is that the new --detect-dark-light flag cannot be set through gitconfig, which means my only option is to force dark on all the time instead of letting it infer from my theme.

lilyball commented 3 months ago

Also I will note that Zellij sets a few env vars that can be used to detect that we're running in Zellij.