From 6d88ffd6a60d49a1ae78da6a64529365b49d53ea Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Wed, 7 Aug 2024 00:32:39 -0400 Subject: [PATCH] Only check the term type for colors once rather than for each declaration, and when gui/termguicolors is not set then "set notermguicolors" should be run to get cterm colors working again in neovim 0.10+ --- vim/colors/darkcloud.vim | 26 ++++++++++++++------------ vim/colors/palette.vim | 4 ++-- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/vim/colors/darkcloud.vim b/vim/colors/darkcloud.vim index a664970..b98d31d 100644 --- a/vim/colors/darkcloud.vim +++ b/vim/colors/darkcloud.vim @@ -19,30 +19,32 @@ endif "declare the name of our theme let colors_name = "darkcloud" +"declare the term type +if has("gui_running") || &termguicolors + let g:term_colors_type = "gui" +else + set notermguicolors "required to use cterm colors + let g:term_colors_type = "cterm" +endif + "sets the highlighting for the given group | format: s:C("Name","Foreground","Background","Style") fun! s:C(group, fg, bg, attr) - if has("gui_running") || &termguicolors - let l:term = "gui" - else - let l:term = "cterm" - endif - if a:fg != "" - exec "hi " . a:group . " " . l:term . "fg=" . a:fg + exec "hi " . a:group . " " . g:term_colors_type . "fg=" . a:fg else - exec "hi " . a:group . " " . l:term . "fg=NONE" + exec "hi " . a:group . " " . g:term_colors_type . "fg=NONE" endif if a:bg != "" - exec "hi " . a:group . " " . l:term . "bg=" . a:bg + exec "hi " . a:group . " " . g:term_colors_type . "bg=" . a:bg else - exec "hi " . a:group . " " . l:term . "bg=NONE" + exec "hi " . a:group . " " . g:term_colors_type . "bg=NONE" endif if a:attr != "" - exec "hi " . a:group . " " . l:term . "=" . a:attr + exec "hi " . a:group . " " . g:term_colors_type . "=" . a:attr else - exec "hi " . a:group . " " . l:term . "=NONE" + exec "hi " . a:group . " " . g:term_colors_type . "=NONE" endif endfun diff --git a/vim/colors/palette.vim b/vim/colors/palette.vim index a81c416..57e1968 100644 --- a/vim/colors/palette.vim +++ b/vim/colors/palette.vim @@ -1,4 +1,4 @@ -if has("gui_running") || &termguicolors +if has("gui_running") || &term != "linux" && &termguicolors let g:cBlack = '#000000' let g:cWhite = '#ffffff' @@ -17,7 +17,7 @@ if has("gui_running") || &termguicolors let g:cLightBg = '#303030' let g:cDarkBg = '#262626' -elseif &term != "linux" && &t_Co >= 256 +elseif &t_Co >= 256 && &term != "linux" let g:cBlack = '0' "#000000 let g:cWhite = '15' "#ffffff