Respect user's 16 ANSI terminal colors

This change (re-)introduce `g:solarized_use16` that allows a user to
request that the color scheme use ANSI 16 colors rather than the
terminal capabilities. This fixes an error on terminals configured with
Solarized colors as the ANSI 16 terminal values.
This commit is contained in:
Andrew Stryker 2026-02-27 16:00:09 -08:00
parent 43e0b11c31
commit 73f74def13
4 changed files with 36 additions and 4 deletions

View file

@ -14,7 +14,15 @@ let g:colors_name = 'solarized8'
let hs_highlight_boolean=1
let hs_highlight_delimiters=1
let s:t_Co = has('gui_running') ? 16777216 : str2nr(&t_Co)
" set color capability order: gui --> user request (guarded) --> terminal
if has('gui_running')
let s:t_Co = 16777216
elseif get(g:, 'solarized_use16', 0) && str2nr(&t_Co) >= 16
let s:t_Co = 16
else
let s:t_Co = str2nr(&t_Co)
endif
let s:tgc = has('termguicolors') && &termguicolors
hi! link Boolean Constant

View file

@ -14,7 +14,15 @@ let g:colors_name = 'solarized8_flat'
let hs_highlight_boolean=1
let hs_highlight_delimiters=1
let s:t_Co = has('gui_running') ? 16777216 : str2nr(&t_Co)
" set color capability order: gui --> user request (guarded) --> terminal
if has('gui_running')
let s:t_Co = 16777216
elseif get(g:, 'solarized_use16', 0) && str2nr(&t_Co) >= 16
let s:t_Co = 16
else
let s:t_Co = str2nr(&t_Co)
endif
let s:tgc = has('termguicolors') && &termguicolors
hi! link Boolean Constant

View file

@ -14,7 +14,15 @@ let g:colors_name = 'solarized8_high'
let hs_highlight_boolean=1
let hs_highlight_delimiters=1
let s:t_Co = has('gui_running') ? 16777216 : str2nr(&t_Co)
" set color capability order: gui --> user request (guarded) --> terminal
if has('gui_running')
let s:t_Co = 16777216
elseif get(g:, 'solarized_use16', 0) && str2nr(&t_Co) >= 16
let s:t_Co = 16
else
let s:t_Co = str2nr(&t_Co)
endif
let s:tgc = has('termguicolors') && &termguicolors
hi! link Boolean Constant

View file

@ -14,7 +14,15 @@ let g:colors_name = 'solarized8_low'
let hs_highlight_boolean=1
let hs_highlight_delimiters=1
let s:t_Co = has('gui_running') ? 16777216 : str2nr(&t_Co)
" set color capability order: gui --> user request (guarded) --> terminal
if has('gui_running')
let s:t_Co = 16777216
elseif get(g:, 'solarized_use16', 0) && str2nr(&t_Co) >= 16
let s:t_Co = 16
else
let s:t_Co = str2nr(&t_Co)
endif
let s:tgc = has('termguicolors') && &termguicolors
hi! link Boolean Constant