Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truecolors not working inside tmux #3668

Open
karamanliev opened this issue Jun 16, 2024 · 7 comments
Open

Truecolors not working inside tmux #3668

karamanliev opened this issue Jun 16, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@karamanliev
Copy link

karamanliev commented Jun 16, 2024

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

@karamanliev karamanliev added the bug Something isn't working label Jun 16, 2024
@Susensio
Copy link

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

@karamanliev
Copy link
Author

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

@jessevdp
Copy link

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.

@karamanliev
Copy link
Author

karamanliev commented Jul 3, 2024

I don't know why I didn't think of this until now, but the solution I've found is to alias lazygit to use screen-256color env in my .zshrc / .bashrc:

alias lazygit='env TERM=screen-256color lazygit'
alias lg='lazygit'

@jessevdp
Copy link

jessevdp commented Jul 3, 2024

Thanks for the workaround 😁

I guess that also sheds some more light on the underlying issue.

Inside of Tmux $TERM is usually set to tmux-256color.

Delta works fine when run standalone inside of Tmux. At least when also setting a :Tc "terminal override in Tmux like so:

set-option -ga terminal-overrides ",*-256color:Tc"

What could be going on inside of lazygit here that messes with this?

@Susensio
Copy link

I don't know why I didn't think of this until now, but the solution I've found is to alias lazygit to use screen-256color env in my .zshrc / .bashrc:

alias lazygit='env TERM=screen-256color lazygit'
alias lg='lazygit'

I don't know if lazygit uses italics but screen-256color does not support italics

Alrefai added a commit to Alrefai/dotfiles that referenced this issue Sep 2, 2024
@sg1fan
Copy link

sg1fan commented Sep 29, 2024

It seems this was introduced by ad0394a because of gdamore/tcell@216e30a removing tmux-256color terminfo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants