[vim/vim] Changing 'background' option does not change terminal colors when termguicolors is on. (#8150)

132 views
Skip to first unread message

Marcin Szamotulski

unread,
Apr 25, 2021, 4:09:35 AM4/25/21
to vim/vim, Subscribed

When termguicolors is set changing background option does not update terminal colors. Terminal colors are however updated if termguicolors is off.

Environment (please complete the following information):

  • Vim 8.2.2805
  • OS: Debian
  • Terminal: GNOME Terminal


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Bram Moolenaar

unread,
Apr 25, 2021, 7:32:22 AM4/25/21
to vim/vim, Subscribed

After setting 'background' you may have to reload your color scheme. Depends on whether the color scheme sets 'background' or takes the current value and adjusts to it.
Your reproduction instructions are incomplete, "a colour scheme" is not specific enough, "change background option" doesn't say what it's set to.

Marcin Szamotulski

unread,
Apr 25, 2021, 3:25:00 PM4/25/21
to vim/vim, Subscribed

The colour scheme I am using is does not require to reload the colours after
changing 'baground' option. Windows with normal buffers change their
background, but not the terminal window.

Another way to reproduce it is to use two different colour schemes, e.g.
vim -u NONE --clean and then

:terminal bash

:set termguicolors
:color blue

The background color of the terminal window does not change, but it does change
when 'termguicolors' is not set.

Marcin Szamotulski

unread,
Apr 25, 2021, 3:46:41 PM4/25/21
to vim/vim, Subscribed

I noticed that when 'termguicolors' is set the 'Terminal' highlight group is ignored.

matveyt

unread,
Apr 26, 2021, 5:44:27 AM4/26/21
to vim/vim, Subscribed

This issue is not really about color scheme / background option. It's about "Normal" color not being re-applied to terminal windows. A simple way to reproduce this issue:

gvim --clean
:term
<C-W>:hi Normal guibg=Blue

Now only a regular window becames "blue", while terminal retains (white) background.

To be fair, :h terminal-size-color says that:

To use a different color the Terminal highlight group can be used, for example:
hi Terminal ctermbg=lightgrey ctermfg=blue guibg=lightgrey guifg=blue
The highlight needs to be defined before the terminal is created. Doing it
later, or setting 'wincolor', will only have effect when the program running
in the terminal displays text or clears the terminal.

So it's maybe kind of expected, but nonetheless it's very inconvenient.

To make things worse, not only "Normal" stops working, but also wincolor relies on external app being able to output specific terminal codes that is not always the case. For example, a terminal running standard Windows cmd will probably never switch to new wincolor no matter how many clear and echo one executes.

Bram Moolenaar

unread,
May 3, 2021, 2:41:25 PM5/3/21
to vim/vim, Subscribed

Closed #8150 via ad43199.

Reply all
Reply to author
Forward
0 new messages