fenetikm / falcon

A colour scheme for terminals, Vim and friends.
MIT License
718 stars 25 forks source link

set guibg when termguicolors is enabled? #78

Open damnskippy opened 1 year ago

damnskippy commented 1 year ago

With termguicolors enabled, vim will utilize highlight-guifg and highlight-guibg even in the terminal (overriding cterm settings) with true color support. However the following conditional prevents this because has(gui_running) evaluates to 0 in terminal. https://github.com/fenetikm/falcon/blob/760d27a7674140c1c1a838b363c52fd705163045/plugin/falcon.vim#L40

If this were to be changed as below it would support setting the guibg for Normal text as well. I have this change and it helps, so thought I'd mention here, not sure if this makes sense. If there is an issue doing this that I'm not seeing, perhaps another option is to have a user g:variable to force this, but this only as a secondary option and only if the change below is not feasible somehow.

diff --git a/plugin/falcon.vim b/plugin/falcon.vim
index 09552e8..b5b7e84 100644
--- a/plugin/falcon.vim
+++ b/plugin/falcon.vim
@@ -37,7 +37,7 @@ function s:HandleInactiveBackground()
     let g:falcon_background=1
   endif

-  if !has("gui_running") || g:falcon_background == 0
+  if (!has("gui_running") && !has('termguicolors')) || g:falcon_background == 0
     hi NonText guifg=#36363a ctermfg=237 guibg=NONE ctermbg=NONE gui=NONE cterm=NONE
     hi Normal guifg=#b4b4b9 ctermfg=249 guibg=NONE ctermbg=NONE gui=NONE cterm=NONE
   else

The above is moot if the user also has terminal theme set to falcon, but is relevant in cases the terminal theme is not set to falcon (as in my use case) but vim is set to use falcon theme.

Thanks.