morhetz / gruvbox

Retro groove color scheme for Vim
13.75k stars 1.1k forks source link

256 are used when inside tmux instead of truecolor #98

Open fedemp opened 8 years ago

fedemp commented 8 years ago

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 commented 8 years ago

my bad. closing.

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

sunaku commented 8 years ago

@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

fedemp commented 8 years ago

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 notifications@github.com:

@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

polyzen commented 8 years ago

@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 commented 8 years ago

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

sunaku commented 8 years ago

@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

polyzen commented 8 years ago

@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"

sunaku commented 8 years ago

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

polyzen commented 8 years ago

Is your gruvbox on master?

sunaku commented 8 years ago

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

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

fedemp commented 8 years ago

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 notifications@github.com:

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

morhetz commented 8 years ago

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

fedemp commented 8 years ago

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

sunaku commented 8 years ago

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:

polyzen commented 8 years ago

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 <notifications@github.com

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.

morhetz commented 8 years ago

@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?

sunaku commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

: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 commented 8 years ago

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:

morhetz commented 8 years ago

@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.

azat-io commented 7 years ago

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?

polyzen commented 7 years ago

Try one or both of these:

azat-io commented 7 years ago

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

polyzen commented 7 years ago

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

morhetz commented 7 years ago

@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

azat-io commented 7 years ago

@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"
polyzen commented 7 years ago

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.

azat-io commented 7 years ago

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"
masaeedu commented 5 years ago

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.

sunaku commented 5 years ago

@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.

WIttyJudge commented 3 years ago

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.