`delta` pager option `--detect-dark-light` not working.
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
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
+1 It would be great to support delta --detect-dark-light=always
| Header |
|---|
| Delta's dark on Kitty's light: |
| Delta's light on Kitty's dark: |
| Delta's light on Kitty's light: |
For now I just settle with delta --light, that is usable, tough a bit bright when in dark theme
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
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
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 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.
+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.