lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

`delta` pager option `--detect-dark-light` not working.

Open andradei opened this issue 7 months ago • 6 comments

Describe the bug Using delta as a pager, it will default to dark theme unless using delta --light, and event --detect-dark-light always is ignored. Also, delta auto-detects dark/light terminal colors by default and omitting --light/--dark from lazygit config.yml still defaults to dark theme pager.

To Reproduce

lazygit/config.yml

gui:
  nerdFontsVersion: "3"
git:
  paging:
    colorArg: always
    pager: delta --detect-dark-light always --paging never

gitconfig

; ...
[delta]
    navigate = true
    line-numbers = true
    side-by-side = true
    whitespace-error-style = 22 reverse
    ; could also have `detect-dark-light = always` and lazygit is not picking it

Expected behavior lazygit uses the delta behavior of auto-detecting dark/light theme.

Screenshots

Notice dark theme on the pager area of lazygit

Image

Version info:

❯ lazygit --version
commit=v0.50.0, build date=2025-05-04T07:59:01Z, build source=binaryRelease, version=0.50.0, os=linux, arch=amd64, git version=2.49.0
_Run `git --version` and paste the result here_

❯ git version
git version 2.49.0

andradei avatar May 09 '25 21:05 andradei

+1 It would be great to support delta --detect-dark-light=always

Header
Delta's dark on Kitty's light:
Image
Delta's light on Kitty's dark:
Image
Delta's light on Kitty's light:
Image

For now I just settle with delta --light, that is usable, tough a bit bright when in dark theme

pricci1 avatar Oct 29 '25 13:10 pricci1

For what it's worth, it is possible to detect light or dark mode by asking the system, e.g. defaults read -g AppleInterfaceStyle which returns either nothing (light mode) or Dark for dark mode. Alternatively this AppleScript Snippet works too:

❯ osascript -e 'tell application "System Events" to tell appearance preferences to get dark mode' | grep -q true && echo Dark || echo Light
Dark

~  
❯ osascript -e 'tell application "System Events" to tell appearance preferences to get dark mode' | grep -q true && echo Dark || echo Light
Light

dwt avatar Nov 11 '25 09:11 dwt

I see the same behavior on MacOS Tahoe with both the builtin Terminal, as well as the Terminal used in Zed

❯ sw_vers 
ProductName:		macOS
ProductVersion:		26.1
BuildVersion:		25B78
❯ delta --version
delta 0.18.2
❯ lazygit --version
commit=, build date=, build source=nix, version=0.56.0, os=darwin, arch=arm64, git version=2.51.0

dwt avatar Nov 11 '25 09:11 dwt

There's a workaround for supporting automatic light/dark switching with delta on macOS: https://github.com/jesseduffield/lazygit/issues/4366#issuecomment-3496862317

Building support for this into lazygit is likely a lot of work, and I'm not really sure it's worth it. But maybe that's because I don't understand why anybody would want to switch dark/light automatically; I prefer my terminal (and IDE) to be always dark. Personal preference, I know.

stefanhaller avatar Nov 11 '25 09:11 stefanhaller

@stefanhaller To answer that question for my use case, I use DarkModeBuddy to automatically switch between dark and light mode based on ambient light. This means that I switch between dark and light mode from a few times a day to a few times an hour.

patrik-csak avatar Nov 11 '25 11:11 patrik-csak

+1

When I try git diff where git is configured to use delta pager, it works on both light and dark mode, but when checking diff in lazygit it defaults to dark mode.

lmdevv avatar Nov 20 '25 16:11 lmdevv