vim-one icon indicating copy to clipboard operation
vim-one copied to clipboard

Strange background color.

Open BurningSmile opened this issue 7 years ago • 21 comments

Hello, I've been trying to figure out what is causing this issue when trying to use your color scheme. Applying the color scheme with set background=dark ends up looking like this.

https://i.imgur.com/jUCpuei.png

I have tried with 2 terminals, gnome-terminal and urxvt. both have 256 color support enabled.

I have tried creating a new vim install in a vm to verify it's not my personal configuration causing an issue.

output of vim --version https://hastebin.burningsmile.tech/wosocugasi.diff

Thanks,

BurningSmile avatar Aug 06 '17 21:08 BurningSmile

Try putting this in your .vimrc before colorscheme one:

set termguicolors

or, the longer version:

"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
"If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support
"(see < http://sunaku.github.io/tmux-24bit-color.html#usage > for more information.)
if (empty($TMUX))
  if (has("nvim"))
  "For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
  let $NVIM_TUI_ENABLE_TRUE_COLOR=1
  endif
  "For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 >
  "Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd >
  " < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 >
  if (has("termguicolors"))
    set termguicolors
  endif
endif

Regardless, it must be before the colorscheme declaration.

oxidist avatar Aug 07 '17 09:08 oxidist

Seems that didn't work on my side, is it something to do with the fact that I'm running a Tmux session?

BurningSmile avatar Aug 07 '17 14:08 BurningSmile

yeah, probably because of the tmux. try vim without tmux?

oxidist avatar Aug 07 '17 15:08 oxidist

Tested that last night, it results in this mess. Though it only happens with when the codeblock above is set. However my assumption is that that is due to my terminal color scheme. As when I load it in gnome-terminal the error is not present and colors look correct.

https://i.imgur.com/FicLxTc.png

BurningSmile avatar Aug 07 '17 15:08 BurningSmile

Oh, wow. Have you tried the same thing with other terminals? Though since you said you were using urxvt and gnome-terminal, it shouldn't happen.

can you post your .vimrc?

oxidist avatar Aug 07 '17 15:08 oxidist

Yeah, gnome-terminal works fine. Here is the ~/.vimrc.

https://hastebin.burningsmile.tech/apexefacoz

BurningSmile avatar Aug 07 '17 15:08 BurningSmile

Try putting syntax on right after call plug#end()

oxidist avatar Aug 07 '17 16:08 oxidist

So it seems the black background color only apperars if the following conditions are met

  1. rxvt-unicode-256 is used.
  2. tmux is used in combination with eaither rxvt-unicode-256 or gnome-terminal.

gnome-terminal on its own is fine

BurningSmile avatar Aug 07 '17 16:08 BurningSmile

I'm having the exact same issue here, with the black background on iTerm2. it happens inside and outside of tmux. I have played with many iTerm settings but none seem to actually resolve the issue :(

codyloyd avatar Sep 27 '17 19:09 codyloyd

Same result here with iTerm2

krzkrzkrz avatar Sep 30 '17 05:09 krzkrzkrz

I think that iTerm2 supports true colours by default, so the only solution that I can see so far is to setup the colorscheme using the following sequence

set termguicolors     " enable true colors support
syntax enable
set background=light
colorscheme one

Make sure that your $TERM variable is at least xterm-256color

This is my current setup on iTerm2.

rakr avatar Sep 30 '17 09:09 rakr

@rakr thanks, this work for me

MacgyverMartins avatar Nov 09 '17 17:11 MacgyverMartins

Keeping this issue open, but unfortunately I don't use a linux based computer. If someone in the linux community who uses Vim, gnome terminal and this theme can help that would be great.

rakr avatar Dec 06 '17 10:12 rakr

@BurningSmile are you still having this issue with linux, gnome-terminal, tmux, and vim? I just fixed it and can provide help :)

joshnroy avatar May 13 '18 03:05 joshnroy

@joshnroy Yup still having the issue since the last time i tested it, just tried with the newest copy of the theme. How did you go about fixing it?

BurningSmile avatar May 13 '18 03:05 BurningSmile

I have the same issue as @BurningSmile using iTerm2, Build 3.1.6 with Vim v.8.0 and without tmux. Just a black background.

My config here.

hamsternik avatar May 21 '18 12:05 hamsternik

au ColorScheme one hi Normal ctermbg=None Another way to disable weird background color is to add line mentioned above to .vimrc before colorscheme one

henrydabrow avatar Oct 28 '18 20:10 henrydabrow

Using au ColorScheme one hi Normal ctermbg=None seemed to have worked at first but then I realized it blasted the statusline colors when in insert or visual mode.

This sequence is what worked for me.

set termguicolors
syntax enable
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
set background=dark
colorscheme one

I have my esc mapped so that is why the color sequence starts with \<Esc> instead of ^[.

I am using: iTerm2 Build 3.2.7 Vim v8.1.873 Tmux v2.8

This is what the $TERM variable prints outside Tmux...

$ echo $TERM
xterm-256color

...and inside.

$ echo $TERM
screen-256color

Probably not relevant but this is the sequence for my .tmux.config

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

Finally, I found this repository with iTerm color presets for this colorscheme and everything matches.

Hope it helps someone in the future.

muriware avatar Feb 14 '19 16:02 muriware

@jmurinello confirmed, these steps work!

diegosomar avatar Feb 29 '20 21:02 diegosomar

I have the exact same issue on MacOS in iTerm2. Switching from the system Vim (/usr/bin/vim) to Homebrew Vim solves the issue. Be aware that the system Vim does not support termguicolors, whereas Homebrew Vim has it (huge version).

$ /usr/bin/vim --version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Dec 13 2019 14:45:40)
Included patches: 1-503, 505-680, 682-1312
Compiled by [email protected]
Normal version without GUI.  Features included (+) or not (-):
+acl               +extra_search      -mouse_netterm     -tag_old_static
-arabic            -farsi             +mouse_sgr         -tag_any_white
+autocmd           +file_in_path      -mouse_sysmouse    -tcl
+autochdir         +find_in_path      -mouse_urxvt       -termguicolors

[...]

Calvin-Xu avatar Mar 19 '20 02:03 Calvin-Xu

Be aware that the system Vim does not support termguicolors

@Calvin-Xu Thank you for this. Been searching for hours and I was wondering why none of the popular solutions were working for me.

niknbr avatar Aug 22 '21 09:08 niknbr