jesseduffield / lazygit

simple terminal UI for git commands
MIT License
47.94k stars 1.72k forks source link

Truecolors not working inside tmux #3668

Open karamanliev opened 2 weeks ago

karamanliev commented 2 weeks ago

Describe the bug This is driving me nuts, I can't really find someone else mention this problem. Inside tmux lazygit colors are looking like this:

image

What is interesting is that if I enter neovim (in tmux as well) and launch lazygit from its terminal colors are fine:

image

It works OK if i set screen-256color in tmux, but then I can't have italics and underlines in SSH. I am using kitty terminal, but tested with wezterm and alacritty and the result is the same. Also when diffing outside lazygit with delta colors are fine. Here are relevant configs:

tmux:

set -g default-terminal "tmux-256color"
set -as terminal-features ",${TERM}:RGB"
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'

delta:

[core]
editor = nvim
pager = delta --features=interactive

[interactive]
  diffFilter = delta

[delta]
  navigate = true
  line-numbers = true
  true-color = always
  syntax-theme = tokyonight_night
  minus-style = "syntax #3b263a"
  minus-emph-style = "syntax #5e355c"
  zero-style = "syntax auto"
  plus-style = "syntax #263949"
  plus-emph-style = "syntax #394b70"
  line-numbers-minus-style = "#f7768e auto"
  line-numbers-zero-style = "#565f89 auto"
  line-numbers-left-style = "#565f89 auto"
  line-numbers-plus-style = "#41a6b5 auto"
  hunk-header-decoration-style = "blue box"

[delta "interactive"]
  side-by-side = true

lazygit:

git:
  paging:
    colorArg: always
    pager: delta --dark --paging=never

To Reproduce Steps to reproduce the behavior:

  1. Start tmux session
  2. Launch lazygit
  3. Truecolors are not working

Expected behavior Colors should be fine inside tmux

Screenshots Truecolors are working fine inside my terminal: image

Version info: commit=v0.42.0, build date=2024-05-19T10:54:29Z, build source=binaryRelease, version=0.42.0, os=linux, arch=amd64, git version=2.45.2

Susensio commented 2 weeks ago

I'm having the same problem, as mentioned in #3362

karamanliev commented 2 weeks ago

Just for the record I have COLORTERM=truecolor setup inside tmux.

jessevdp commented 6 days ago

I think I have the exact same problem...

A weird-ish yellow background for both additions and deletions when inside Tmux > lazygit. The regular git-delta diff colors work when lazygit runs outside of Tmux. Or when just using git diff (using delta) inside of Tmux.

Somehow that 3rd layer (Tmux > lazygit > delta) messes up the background colors from my theme.