morhetz / gruvbox

Retro groove color scheme for Vim
13.85k stars 1.11k forks source link

Transparent background not working. #375

Open PhineasGreene opened 3 years ago

PhineasGreene commented 3 years ago

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?

Shadow53 commented 3 years ago

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
PhineasGreene commented 3 years ago
autocmd VimEnter * hi Normal ctermbg=none

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

hehelego commented 3 years ago

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

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

sol

M3X3M commented 3 years ago

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

tusqasi commented 3 years ago

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?

uunnxx commented 3 years ago

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

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

normen commented 3 years ago

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

koterevma commented 3 years ago

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

sevillaarvin commented 3 years ago

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 ```vim " $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 ```
vim@8.2 manjaro ``` VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Sep 15 2021 21:48:21) Included patches: 1-3441 Compiled by Arch Linux ```
kumarmo2 commented 2 years ago

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

pratikthorat8 commented 2 years ago

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?

DoubleLazyZ commented 2 years ago

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

felixiinohayes commented 8 months ago

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.