Running the following script in my terminal emulator, and the Neovim terminal, produce different output:
#!/bin/bash
for i in {30..37}
do
printf "Color $i: \033[${i}m NOT BOLD \033[0m - \033[${i};1m BOLD \033[0m\n"
done
Terminal Emulator:
Neovim Terminal:
(I use Kitty, and I've defined the 16 terminal colors to be the same as those used by NeoSolarized.)
I first noticed this issue when the output of ls didn't look right in Neovim's terminal. This issue only shows up when terminal commands output colored text using ANSI escape codes30–37 (foreground colors) along with the bold code 1.
The discrepancy is due to Kitty having made the decision render bold text as the same color but bold (which makes a heck of a lot of sense to me), as opposed to the traditional behavior (bold as bright) which is to bold the text but also shift the color to the corresponding background color (40–47).
To fix this, I added the following in my init.vim:
" Automatically update some setting related to colors
augroup update_colors_autocommands
au!
au ColorScheme,VimEnter * call UpdateColors()
augroup END
function! UpdateColors()
" Style ChooseWin to fit in with NeoSolarized colors
let g:choosewin_color_label = {'gui': [g:terminal_color_2 , g:terminal_color_15, 'bold'], 'cterm': [2 , 15, 'bold']}
let g:choosewin_color_label_current = {'gui': [g:terminal_color_11, g:terminal_color_0 ] , 'cterm': [11, 0 ]}
let g:choosewin_color_other = {'gui': [g:terminal_color_11, g:terminal_color_11] , 'cterm': [11, 11]}
let g:choosewin_color_land = {'gui': [g:terminal_color_3 , g:terminal_color_0 ] , 'cterm': [3 , 0 ]}
" Make term colors 8-15 the same as 0-7 to get around bold as bright issue.
let g:terminal_color_8 = g:terminal_color_0
let g:terminal_color_9 = g:terminal_color_1
let g:terminal_color_10 = g:terminal_color_2
let g:terminal_color_11 = g:terminal_color_3
let g:terminal_color_12 = g:terminal_color_4
let g:terminal_color_13 = g:terminal_color_5
let g:terminal_color_14 = g:terminal_color_6
let g:terminal_color_15 = g:terminal_color_7
endfunction
The easiest thing to do (which I've seen in other colorschemes) would be to change the definitions of g:terminal_colors[0-15] to:
let g:terminal_color_0 = s:gui_base03
let g:terminal_color_1 = s:gui_red
let g:terminal_color_2 = s:gui_green
let g:terminal_color_3 = s:gui_yellow
let g:terminal_color_4 = s:gui_blue
let g:terminal_color_5 = s:gui_magenta
let g:terminal_color_6 = s:gui_cyan
let g:terminal_color_7 = s:gui_base2
let g:terminal_color_8 = g:terminal_color_0
let g:terminal_color_9 = g:terminal_color_1
let g:terminal_color_10 = g:terminal_color_2
let g:terminal_color_11 = g:terminal_color_3
let g:terminal_color_12 = g:terminal_color_4
let g:terminal_color_13 = g:terminal_color_5
let g:terminal_color_14 = g:terminal_color_6
let g:terminal_color_15 = g:terminal_color_7
However, that might be surprising/annoying to a bunch of users of the colorscheme who for whatever reason like the default behavior.
So maybe the right solution would be to add a new option like g:neosolazired_boldasbright which by default is equal to 1, so nothing changes for existing users, but when set to 0 it sets the term colors as above. (Setting the default to 0 would be a more aggressive change, but is maybe worth considering. Probably comes down to the behavior most people will expect by default for how bold shows up in the terminal.)
(As an aside, either solution above would break some other parts of my config, like the lines above starting with let g:choosewin_color. I'd separately love it if this color scheme defined some global variables that correspond to the hex code for each of the colors so I could use them elsewhere in my config (e.g., let g:neosolarize_base03 = '#002b36').
I'd be happy to file a pull request implementing whatever version of the above seems most sensible to you.
Also thanks for making NeoSolarized, I was so happy when I found it 😄.
Running the following script in my terminal emulator, and the Neovim terminal, produce different output:
Terminal Emulator:
Neovim Terminal:
(I use Kitty, and I've defined the 16 terminal colors to be the same as those used by NeoSolarized.)
I first noticed this issue when the output of
ls
didn't look right in Neovim's terminal. This issue only shows up when terminal commands output colored text using ANSI escape codes30–37
(foreground colors) along with the bold code1
.The discrepancy is due to Kitty having made the decision render bold text as the same color but bold (which makes a heck of a lot of sense to me), as opposed to the traditional behavior (bold as bright) which is to bold the text but also shift the color to the corresponding background color (40–47).
To fix this, I added the following in my
init.vim
:It took a lot of time/frustration to figure out what was going on here, and while NeoSolarized isn't doing anything wrong by setting
g:terminal_color[0-15]
the way it does, https://github.com/icymind/NeoSolarized/blob/1af4bf6835f0fbf156c6391dc228cae6ea967053/colors/NeoSolarized.vim#L864-L879 I think it would be great if some changes could be made to make this easier for others in the future.The easiest thing to do (which I've seen in other colorschemes) would be to change the definitions of
g:terminal_colors[0-15]
to:However, that might be surprising/annoying to a bunch of users of the colorscheme who for whatever reason like the default behavior.
So maybe the right solution would be to add a new option like
g:neosolazired_boldasbright
which by default is equal to1
, so nothing changes for existing users, but when set to0
it sets the term colors as above. (Setting the default to0
would be a more aggressive change, but is maybe worth considering. Probably comes down to the behavior most people will expect by default for how bold shows up in the terminal.)(As an aside, either solution above would break some other parts of my config, like the lines above starting with
let g:choosewin_color
. I'd separately love it if this color scheme defined some global variables that correspond to the hex code for each of the colors so I could use them elsewhere in my config (e.g.,let g:neosolarize_base03 = '#002b36'
).I'd be happy to file a pull request implementing whatever version of the above seems most sensible to you.
Also thanks for making NeoSolarized, I was so happy when I found it 😄.