gruvbox icon indicating copy to clipboard operation
gruvbox copied to clipboard

256 are used when inside tmux instead of truecolor

Open fedemp opened this issue 8 years ago • 32 comments

2016-02-18-130131_1026x766_scrot I'm using st which supports truecolor and also nvim.

I run NVIM_TUI_ENABLE_TRUE_COLOR=1 nvim and then select gruvbox.

$TERM is tmux-256color.

fedemp avatar Feb 18 '16 16:02 fedemp

my bad. closing.

https://github.com/tmux/tmux/issues/34

fedemp avatar Feb 18 '16 19:02 fedemp

@fedemp what was the problem and how did you fix it? :cold_sweat:

I'm getting weird colors under NVIM 0.1.2 with NVIM_TUI_ENABLE_TRUE_COLOR=1 but outside tmux: screenshot

sunaku avatar Feb 18 '16 20:02 sunaku

The problem is that tmux does not support true color.

At least the latest official release. A patch was merged a couple of days ago that adds support for true color.

You can try to compile from source code to check if it works.

2016-02-18 17:15 GMT-03:00 Suraj N. Kurapati [email protected]:

@fedemp https://github.com/fedemp what was the problem and how did you fix it? [image: :cold_sweat:]

I'm getting weird colors under NVIM 0.1.2 with NVIM_TUI_ENABLE_TRUE_COLOR=1 too: [image: gruvbox-neovim-24bit] https://cloud.githubusercontent.com/assets/9863/13156793/17ef74e2-d639-11e5-97b6-92fe20a67151.png

— Reply to this email directly or view it on GitHub https://github.com/morhetz/gruvbox/issues/98#issuecomment-185896559.

Federico MP

fedemp avatar Feb 18 '16 20:02 fedemp

@fedemp, apparently you didn't notice they're the one who got the patch to the mergeable state :p They also mentioned this is happening outside tmux.

polyzen avatar Feb 18 '16 20:02 polyzen

@sunaku, looks good to me in termite. Is it possible your terminal doesn't support truecolor :p?

polyzen avatar Feb 18 '16 20:02 polyzen

@fedemp Thanks for explaining. :+1: Sorry about the miscommunication: I had updated my comment afterwards to clarify that I could reproduce the problem outside of tmux. :sweat_smile:

@polyzen I'm using NeoVim 0.1.2 under st 0.6 which does indeed support 24-bit colors on my system: 2016-02-18-142314_1165x596_scrot

sunaku avatar Feb 18 '16 21:02 sunaku

@sunaku, Is it possible you're using a different colorscheme? Other shots of borked-gruvbox didn't quite look like this. Check to see :colorscheme responds "gruvbox"

polyzen avatar Feb 18 '16 22:02 polyzen

Nope, it's definitely Gruvbox. :disappointed_relieved: To be sure, I checked against the Yowish colorscheme in st and xterm:

Yowish in st (24-bit colors)

2016-02-18-204703_634x388_scrot

Yowish in xterm (256 colors)

2016-02-18-204134_640x384_scrot

Gruvbox in st (24-bit colors)

2016-02-18-205146_634x388_scrot

Gruvbox in xterm (256 colors)

2016-02-18-205059_640x384_scrot

sunaku avatar Feb 19 '16 04:02 sunaku

Is your gruvbox on master?

polyzen avatar Feb 19 '16 05:02 polyzen

Yes, I'm synced to commit 3f228101cdd5ae818415c7ebbcb42078c2476ea3, which is master currently. :confounded:

@fedemp does this happen for you in NeoVim directly under st?

sunaku avatar Feb 19 '16 05:02 sunaku

Under st 0.6 and neovim, gruvbox uses the right colors.

As I said, the problem is that tmux does not support true color.

2016-02-19 4:22 GMT-03:00 Pavel Pertsev [email protected]:

Reopened #98 https://github.com/morhetz/gruvbox/issues/98.

— Reply to this email directly or view it on GitHub https://github.com/morhetz/gruvbox/issues/98#event-556195390.

Federico MP

fedemp avatar Feb 19 '16 13:02 fedemp

@fedemp Thank you, got it! Reopened due to need of adding this case to documentation//faq and @sunaku 's somehow related issue.

morhetz avatar Feb 19 '16 13:02 morhetz

2016-02-19-105439_525x379_scrot

Just for the record, today I compiled tmux (master branch) from source and true color is enabled.

Since I always use st, I just added this to this .tmux.conf: set-option -ga terminal-overrides ",st-256color:Tc". Source: https://sunaku.github.io/tmux-24bit-color.html#usage

fedemp avatar Feb 19 '16 14:02 fedemp

As expected, I have same the problem inside the current tmux master (attached to st 0.6) too: 2016-02-19-122439_724x388_scrot

@fedemp What OS or Linux distro are you using? Perhaps this bug is specific to Void Linux's st package. :point_up:

sunaku avatar Feb 19 '16 20:02 sunaku

An associate said it works for him with the same setup on Arch Linux.

https://projects.archlinux.org/svntogit/community.git/tree/trunk?h=packages/st

On Fri, Feb 19, 2016 at 3:30 PM, Suraj N. Kurapati <[email protected]

wrote:

As expected, I have same the problem inside the current tmux master (attached to st 0.6) too: [image: 2016-02-19-122439_724x388_scrot] https://cloud.githubusercontent.com/assets/9863/13188063/0334c0a4-d704-11e5-9116-a03ce25f778c.png

@fedemp https://github.com/fedemp What OS or Linux distro are you using? Perhaps this bug is specific toVoid Linux http://www.voidlinux.eu's st package. [image: :point_up:]

— Reply to this email directly or view it on GitHub https://github.com/morhetz/gruvbox/issues/98#issuecomment-186393798.

polyzen avatar Feb 19 '16 22:02 polyzen

@sunaku Sorry, still got no idea what could cause this behaviour. Could you try checking any other term that supports true color mode so this weird issue could be definitely localized to the st package?

morhetz avatar Feb 19 '16 22:02 morhetz

I tried compiling st from source myself (at commit 4fdba860c8db70035e9749806ecc6ca2d7c418d0) but no luck; the problem still occurs. I'll try asking in the st mailing list and also try a different terminal next.

sunaku avatar Mar 04 '16 18:03 sunaku

I tried the libvte-based sakura terminal mentioned here :disappointed: but I still see the same problem:

$ sudo xbps-install sakura

Name   Action    Version           New version            Download size
vte    install   -                 0.28.2_14              279KB
vte3   install   -                 0.42.4_1               161KB
sakura install   -                 3.3.4_1                48KB

Size to download:              490KB
Size required on disk:        2227KB

2016-03-04-103611_1161x289_scrot 2016-03-04-103524_1170x454_scrot

sunaku avatar Mar 04 '16 18:03 sunaku

:relieved: Alas, it turns out that the problem was in my Vim config! :sweat_smile: I moved it away, cloned gruvbox as ~/.config/nvim, and tried the repro: gruvbox now appears correctly (both in st and sakura)! :sparkles: :triumph:

sunaku avatar Mar 04 '16 18:03 sunaku

The culprit was the https://github.com/zefei/vim-colortuner plugin, which had a ColorScheme autocommand that would run as soon as I entered :colorscheme gruvbox and ruin the colors. :cop:

Disabling it on startup with let g:colortuner_enabled = 0 is enough to fix the problem though. :smiley_cat:

sunaku avatar Mar 04 '16 19:03 sunaku

@sunaku Oh, I'm so glad you've localized this issue. I'll keep this opened till I've got the original tmux case added to the wiki.

morhetz avatar Mar 04 '16 21:03 morhetz

I have the same question with the following settings:

.vimrc:

set termguicolors
set t_Co=256
set t_AB=^[[48;5;%dm
set t_AF=^[[38;5;%dm]]]]

highlight Normal ctermbg=black ctermfg=white
set background=dark

Plug 'morhetz/gruvbox'
colorscheme gruvbox
let g:gruvbox_contrast_dark = 'hard'

.tmux.conf:

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

Screenshot of Vim:

v1

Screenshot of Vim inside Tmux:

v2


Any ideas?

azat-io avatar Jul 24 '17 12:07 azat-io

Try one or both of these:

polyzen avatar Jul 24 '17 19:07 polyzen

@polyzen Adding this lines crash my Vim ezgif-2-3d150568c8

azat-io avatar Jul 24 '17 20:07 azat-io

It's probably due to the escape characters. Try yanking them directly from :h xterm-true-color, if you haven't already.

polyzen avatar Jul 24 '17 20:07 polyzen

@azat-io

  1. That's unrelated to the gruvbox
  2. What's your terminal $TERM?
  3. What's tmux version
  4. try TERM=xterm-256color tmux
  5. https://github.com/tmux/tmux/issues/696#issuecomment-268665191

morhetz avatar Jul 24 '17 20:07 morhetz

@polyzen This code also not works for me:

if has("termguicolors")     " set true colors
    let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
    let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
    set termguicolors
endif

highlight Normal ctermbg=black ctermfg=white
set background=dark

Plug 'morhetz/gruvbox'
colorscheme gruvbox
let g:gruvbox_contrast_dark = 'hard'

@morhetz I'm using Tmux v2.5

azat@pc echo $TERM
xterm-256color

Adding this code to .tmux.conf not works:

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

azat-io avatar Jul 24 '17 20:07 azat-io

Could it be the highlight line? I'm not familiar with that one.

Pretty sure the Plug line doesn't belong there, but not relevant to this issue.

polyzen avatar Jul 24 '17 21:07 polyzen

I don't understand why, but problem was solved with the following settings:

.vimrc

highlight Normal ctermbg=black ctermfg=white
set background=dark

Plug 'morhetz/gruvbox'
colorscheme gruvbox
let g:gruvbox_contrast_dark = 'hard'

.tmux.conf

set -g default-terminal "screen-256color"

azat-io avatar Jul 24 '17 21:07 azat-io

I realized that reloading tmux conf after changing the default-terminal and terminal-overrides settings while a session is active results in that weird pink airline color and doesn't completely fix the problem. I had to actually kill my session and restart tmux from scratch to fix the issue. I don't know if anyone else is running into the same problem.

masaeedu avatar Mar 01 '19 19:03 masaeedu

@masaeedu that's just how tmux works: You need to detach and reattach for terminal-overrides to take effect. :neckbeard: Check out https://github.com/tmux/tmux/pull/112#issuecomment-150636074 and the origin of the Tc attribute for reference.

sunaku avatar Mar 02 '19 16:03 sunaku

When I change my terminal to urxvt and install rxvt-unicode-256color I've got a problems gruvbox does not show true color. I fix it with by adding let g:gruvbox_termcolors = 16 before colorscheme gruvbox and it works fine.

WIttyJudge avatar Dec 31 '20 14:12 WIttyJudge