gruvbox icon indicating copy to clipboard operation
gruvbox copied to clipboard

Transparent background not working.

Open PhineasGreene opened this issue 3 years ago • 15 comments

I'm really liking the colors, but the transparent background option won't work for me. Here's my vimrc (the relevant portion at least):

call plug#begin()

Plug 'vim-airline/vim-airline' Plug 'morhetz/gruvbox'

call plug#end()

let g:airline_powerline_fonts = 1 let g:gruvbox_contrast_dark = 'soft' let g:gruvbox_transparent_bg = 1 set bg = dark colorscheme gruvbox

This makes everything look good, but doesn't make the background transparent like I want it. In other words, toggling the value of g:gruvbox_transparent_bg has no effect. I am using suckless's simple terminal (st), which has a transparent background. If fact, I can see transparency through the edges where the terminal window extends past the rows and columns of text. Why am I not getting transparency?

PhineasGreene avatar Dec 28 '20 23:12 PhineasGreene

I'm getting a similar issue. I did a search through the repository using GitHub's search bar for the text "transparent", and it found no results. Perhaps support for this option was removed at some point?

Searching through the other issues, I found this "solution", which works well with my setup that also uses the community gruvbox theme for Konsole:

autocmd VimEnter * hi Normal ctermbg=none

Shadow53 avatar Dec 31 '20 18:12 Shadow53

autocmd VimEnter * hi Normal ctermbg=none

Works well for me too. Thanks for suggesting it Shadow53.

PhineasGreene avatar Jan 01 '21 00:01 PhineasGreene

I have encountered similar issue, and I think it's not gruvbox's fault.

I 'm using alacritty which support true color and opacity.
so I have set termguicolors in my vimrc.
But I found that termguicolors is conflict with g:gruvbox_transparent_bg.

if I have termguicolors but no colorscheme, the transparent background works without problems.
but when I have tgc and any colorscheme enabled at the same time, I can't get a transparent background.

hehelego avatar Jan 19 '21 08:01 hehelego

A relevant issue is here.
It did work, however, I found the number column wired.

sol

hehelego avatar Jan 19 '21 08:01 hehelego

I'm getting a similar issue. I did a search through the repository using GitHub's search bar for the text "transparent", and it found no results. Perhaps support for this option was removed at some point?

Searching through the other issues, I found this "solution", which works well with my setup that also uses the community gruvbox theme for Konsole:

autocmd VimEnter * hi Normal ctermbg=none

this works like a charm. Still I have the same behavior with transparent_bg not having any effect

M3X3M avatar Feb 11 '21 16:02 M3X3M

This works for me autocmd VimEnter * hi Normal ctermbg=NONE guibg=NONE

I had the same problem.

Putting this exact same thing in .vimrc doesn't work but running this manually it works. Why?

tusqasi avatar Apr 11 '21 02:04 tusqasi

A relevant issue is here. It did work, however, I found the number column wired.

sol

Delete hi NonText for removing ugly blue color

uunnxx avatar Aug 27 '21 11:08 uunnxx

Firstly, run some 'Compositing Manager' from the list: https://wiki.archlinux.org/title/Xorg#Composite compton, picom, or unagi

then set terminal settings: in my case I use Alacritty: $HOME/.config/alacritty/alacritty.yml

background_opacity: 0.90

Then in your vimrc or init.vim add: hi Normal guibg=NONE ctrembg=NONE or with ! hi! Normal guibg=NONE ctrembg=NONE

image

uunnxx avatar Aug 27 '21 11:08 uunnxx

For me this solution breaks as soon as I open a :term window. Anyone having the same issue?

normen avatar Nov 03 '21 20:11 normen

This works for me autocmd VimEnter * hi Normal ctermbg=NONE guibg=NONE

I had the same problem.

Putting this exact same thing in .vimrc doesn't work but running this manually it works. Why?

I have same problem - if I execute :highlight Normal ctermbg=NONE guibg=NONE while running vim, background becomes transparent but if this same command is executed from vimrc or with autocmd It has no effect

koterevma avatar Nov 04 '21 12:11 koterevma

This works for me autocmd VimEnter * hi Normal ctermbg=NONE guibg=NONE

I had the same problem.

Putting this exact same thing in .vimrc doesn't work but running this manually it works. Why?

This works for me on .vimrc. Using picom and bspwm. gruvbox is the only plugin so far.

My current .vimrc
" $HOME/.vimrc

source $VIMRUNTIME/defaults.vim
set clipboard=unnamedplus
set background=dark

let &t_ZH="\e[3m"
let &t_ZR="\e[23m"

autocmd vimenter * ++nested colorscheme gruvbox
autocmd VimEnter * hi Normal ctermbg=NONE guibg=NONE

" https://github.com/morhetz/gruvbox/wiki/Terminal-specific
"
"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
[email protected] manjaro
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Sep 15 2021 21:48:21)
Included patches: 1-3441
Compiled by Arch Linux

sevillaarvin avatar Nov 18 '21 20:11 sevillaarvin

I'm getting a similar issue. I did a search through the repository using GitHub's search bar for the text "transparent", and it found no results. Perhaps support for this option was removed at some point?

Searching through the other issues, I found this "solution", which works well with my setup that also uses the community gruvbox theme for Konsole:

autocmd VimEnter * hi Normal ctermbg=none

worked for me in neovim as well. Thanks

kumarmo2 avatar Jul 10 '22 23:07 kumarmo2

autocmd VimEnter * hi Normal ctermbg=none

I am fairly new to vim so I have no idea what exactly is to be done here. Where Shall I add it?

pratikthorat8 avatar Jul 22 '22 21:07 pratikthorat8

@pratikthorat8 If you are use lua to config, you can add it in lua file and write like this, you can learn lua config by ThePrimeagen on YT.

vim.cmd("let g:gruvbox_transparent_bg = 1")
vim.cmd("autocmd VimEnter * hi Normal ctermbg=NONE guibg=NONE")
vim.cmd("colorscheme gruvbox")

hope it will help.

DoubleLazyZ avatar Aug 26 '22 18:08 DoubleLazyZ

I managed to fix this in vim by adding both lines to my .vimrc file:

autocmd VimEnter * hi Normal ctermbg=NONE guibg=NONE
highlight Normal guibg=NONE ctermbg=NONE

For some reason it didn't work when only one of these lines was added.

felixiinohayes avatar Mar 28 '24 12:03 felixiinohayes