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

Wrong colors inside tmux #1

Closed
rpereira opened this issue Jun 9, 2016 · 14 comments
Closed

Wrong colors inside tmux #1

rpereira opened this issue Jun 9, 2016 · 14 comments

Comments

@rpereira
Copy link

rpereira commented Jun 9, 2016

Hi @lifepillar,

The colors are rendered nicely outside tmux, but here's how it looks inside tmux:

screen shot 2016-06-09 at 10 01 00

Running on a 24-bit capable terminal emulator; latest version of tmux, with the following settings:

set -g default-terminal "xterm-256color"
set -ga terminal-overrides ",xterm-256color:Tc"

Any idea what the problem might be? Thanks.

@lifepillar
Copy link
Owner

Maybe related to vim/vim#804?

@nelsyeung
Copy link

@rpereira
Copy link
Author

rpereira commented Jun 9, 2016

@lifepillar It might be...

@nelsyeung I don't think so. If if set screen-256 instead of xterm, things become even crazier. :)

screen shot 2016-06-09 at 22 20 46

@nelsyeung
Copy link

@ruiafonsopereira Are you sure your TERM variable is actually screen-256color, thought? I mean a lot of people set tmux default terminal to be screen-256color then have export TERM=xterm-256color, which is wrong.

If you do echo $TERM inside tmux with set -g default-terminal "screen-256color", it should be screen-256color. If not, then you must have a .bashrc or some other start up script with the export TERM variable set there, or it can be in your terminal app settings as well.

I find that a lot of colour problems with tmux is to do with inconsistency between tmux TERM var and the actual TERM var. So it's worth a shot.

I don't actually have this problem with my tmux on Terminal.app and on SUSE enterprise Konsole.

@rpereira
Copy link
Author

rpereira commented Jun 10, 2016

Hi @nelsyeung

Thanks for pointing that out, but I actually have set the right TERM variable. However, my terminal app (iTerm2) reports xterm-256 color and I can't change that to screen. This was never a problem until I've tried Vim and tmux with true color.

@lifepillar
Copy link
Owner

lifepillar commented Jun 10, 2016

Can anyone check NeoVim with true color support enabled? Colors are ok outside tmux, but they are off inside tmux. With tmux configured as follows NeoVim displays colors just fine in iTerm2:

set -g default-terminal    "screen-256color"
set -ga terminal-overrides ",xterm-256color:Tc"

I suggest that we wait for vim/vim#804 to be closed, to see whether that fixes this issue as well.

@rpereira
Copy link
Author

Unfortunately, the issue on the vim repository doesn't seem to get a lot of attention.

Perhaps we should wait, @lifepillar

@lifepillar
Copy link
Owner

@ruiafonsopereira The only workaround I can think of is to set your 16 terminal colors to the Solarized palette and set notermguicolors in vimrc when you are inside tmux:

  if has('termguicolors') && $TERM_PROGRAM ==# 'iTerm.app' && $TERM !~# '^\%(screen\|tmux\)'
    set termguicolors
  else
    set notermguicolors
  endif

Or use NeoVim…

@lifepillar
Copy link
Owner

It seems that Vim p1942 fixes this problem. @ruiafonsopereira Could you please confirm that?

@rpereira
Copy link
Author

@lifepillar
I've seen the patch, but without changing configuration, now Vim renders everything in grey when inside Tmux if termguicolors is set. I'd have try and address that issue first.

@rpereira
Copy link
Author

rpereira commented Jun 18, 2016

@lifepillar and @nelsyeung Any idea what might be or what am I missing?

screen shot 2016-06-18 at 11 40 40

My configurations are the same specified on #1 (comment)

Inside tmux:

➔ echo $TERM
screen-256color

➔ tmux info | grep Tc
197: Tc: (flag) true

Thanks.

@lifepillar
Copy link
Owner

lifepillar commented Jun 18, 2016

@ruiafonsopereira Yes, I had the same problem. You need to add this to your vimrc:

set t_8f=^[[38;2;%lu;%lu;%lum  " Needed in tmux
set t_8b=^[[48;2;%lu;%lu;%lum  " Ditto

(where ^[ is literal Esc, that you get by typing <C-V><C-[>). See :h xterm-true-color for the details.

@rpereira
Copy link
Author

My bad. I was experimenting and changed “;” to “:” and forgot to revert. Problem solved. Thanks @lifepillar
.

On 18 Jun 2016, at 19:59, Lifepillar notifications@github.com wrote:

@ruiafonsopereira https://github.com/ruiafonsopereira Yes, I had the same problem. You need to add this to your vimrc:

set t_8f=^[[38;2;%lu;%lu;%lum " Needed in tmux
set t_8b=^[[48;2;%lu;%lu;%lum " Ditto
(where ^[ is literal Esc, that you get by typing <C-[>). See :h xterm-true-colors for the details.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub #1 (comment), or mute the thread https://github.com/notifications/unsubscribe/ADri1roFdFZd2mM3qY7m1gPwmRVhmhHCks5qNEAugaJpZM4IxxIr.

@vprasanth
Copy link

tmux/tmux#696

The comment regarding properly overriding was my problem. Maybe that will help anyone who still is having the colours look funky within tmux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants