From 81533a9ca9f1f95520fdeeaea24c98304e0b427a Mon Sep 17 00:00:00 2001 From: simchri Date: Fri, 3 Jan 2025 20:23:03 +0100 Subject: [PATCH 1/2] apply props when notermguicolors is set --- autoload/base16.vim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/autoload/base16.vim b/autoload/base16.vim index d482b22..79eda67 100644 --- a/autoload/base16.vim +++ b/autoload/base16.vim @@ -44,8 +44,14 @@ function! base16#highlight(bang, group, ...) endif if len(l:attrs) > 0 execute 'highlight' a:group 'gui='.join(l:attrs, ',') + if !has('termguicolors') || !&termguicolors + execute 'highlight' a:group 'cterm='.join(l:attrs, ',') + endif elseif a:bang execute 'highlight' a:group 'gui=NONE' + if !has('termguicolors') || !&termguicolors + execute 'highlight' a:group 'cterm=NONE' + endif endif endfunction From a343b2a6391e0c82640caa93facde496b411f4a5 Mon Sep 17 00:00:00 2001 From: simchri Date: Fri, 3 Jan 2025 20:52:56 +0100 Subject: [PATCH 2/2] refactor termguicolors conditional --- autoload/base16.vim | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/autoload/base16.vim b/autoload/base16.vim index 79eda67..20b0e96 100644 --- a/autoload/base16.vim +++ b/autoload/base16.vim @@ -6,6 +6,7 @@ function! base16#highlight(bang, group, ...) echohl None return endif + let l:termguicolors = (has('termguicolors') && &termguicolors) let l:fg = 0 let l:bg = 0 let l:sp = 0 @@ -15,14 +16,14 @@ function! base16#highlight(bang, group, ...) let l:fg = 1 let [l:gui, l:cterm] = s:Color(l:arg[3:]) execute 'highlight' a:group 'guifg='.l:gui - if !has('termguicolors') || !&termguicolors + if !termguicolors execute 'highlight' a:group 'ctermfg='.l:cterm endif elseif l:arg =~? '^bg=' let l:bg = 1 let [l:gui, l:cterm] = s:Color(l:arg[3:]) execute 'highlight' a:group 'guibg='.l:gui - if !has('termguicolors') || !&termguicolors + if !termguicolors execute 'highlight' a:group 'ctermbg='.l:cterm endif elseif l:arg =~? '^sp=' @@ -44,12 +45,12 @@ function! base16#highlight(bang, group, ...) endif if len(l:attrs) > 0 execute 'highlight' a:group 'gui='.join(l:attrs, ',') - if !has('termguicolors') || !&termguicolors + if !termguicolors execute 'highlight' a:group 'cterm='.join(l:attrs, ',') endif elseif a:bang execute 'highlight' a:group 'gui=NONE' - if !has('termguicolors') || !&termguicolors + if !termguicolors execute 'highlight' a:group 'cterm=NONE' endif endif