delta icon indicating copy to clipboard operation
delta copied to clipboard

🐛 Always using light theme on dark background

Open EbonJaeger opened this issue 1 year ago • 13 comments
trafficstars

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.

  • [x] Please include the raw text output from git, so that we can reproduce the problem. (You can use git --no-pager to produce the raw text output.)
    diff --git a/packages/a/adw-gtk3-theme/package.yml b/packages/a/adw-gtk3-theme/package.yml
    index aeb8a25200..06017a5c30 100644
    --- a/packages/a/adw-gtk3-theme/package.yml
    +++ b/packages/a/adw-gtk3-theme/package.yml     @@ -1,8 +1,8 @@
     name       : adw-gtk3-theme
    -version    : '5.2'
    -release    : 12
    +version    : '5.3'
    +release    : 13
     source     :
    -    - https://github.com/lassekongo83/adw-gtk3/archive/refs/tags/v5.2.tar.gz : 1265b9dbc933bf602da1c419e515752bc8d7b9e6f8a09eafd740315d321501d7
    +    - https://github.com/lassekongo83/adw-gtk3/releases/download/v5.3/adw-gtk3v5.3.tar.xz : 2e6e87935bef30936e40d07c7af4fd20754e77917be224f61c4346867196bef0
     license    : LGPL-2.1-only
     homepage   : https://github.com/lassekongo83/adw-gtk3
     component  : desktop.them
    
  • [x] A screenshot of Delta's output is often helpful also.

image

EbonJaeger avatar Mar 21 '24 23:03 EbonJaeger

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?

dandavison avatar Mar 21 '24 23:03 dandavison

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

rsmmr avatar Mar 22 '24 06:03 rsmmr

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 avatar Mar 22 '24 08:03 bash

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

bash avatar Mar 22 '24 09:03 bash

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

EbonJaeger avatar Mar 22 '24 14:03 EbonJaeger

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!

EbonJaeger avatar Mar 22 '24 15:03 EbonJaeger

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

bash avatar Mar 22 '24 15:03 bash

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 avatar Mar 27 '24 18:03 lilyball

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

lilyball avatar Mar 27 '24 18:03 lilyball