neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 28ff4deda7a0c452d3a35de3da5e5ff676824915
parent a950e8ea9d38ab2e75f7341aea44c865b211584e
Author: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
Date:   Sat, 29 Nov 2025 19:36:05 +0200

fix(colorscheme): adjust `StatusLine[NC]` for diagnostics #36719

Problem: It is desirable for the default statusline to contain colored
  diagnostics information. However, current `StatusLine` group is
  purposefully defined as almost inverted `Normal` to "make current
  window obvious". This makes diagnostic information from
  `vim.diagnostic.status()` barely visible: it uses established
  `DiagnosticSignXxx` groups which have colored foreground with
  lightness close to `StatusLine` background.

  Also the `StatusLineNC` group is fairly different from `Normal` in
  order to both "makes window separators clear" and "be different from
  `CursorLine`". But not as mush different as `StatusLine` because
  "`StatusLine` and `StatusLineNC` should be clearly different".

Solution: Make both `StatusLine` and `StatusLineNC` be slightly closer
  in lightness to `Normal`. This makes `StatusLine` and `StatusLineNC`
  groups satisfy their conditions in the following way:
  - `vim.diagnostic.count()` is readable on `StatusLine` - yes.
  - `vim.diagnostic.count()` is readable on `StatusLineNC` - yes.
  - `StatusLine` makes current window obvious - I'd say yes.
  - `StatusLine` and `StatusLineNC` are clearly different - it depends
    on the eyes and monitor. The current is clearly better, but the new
    ones I'd say are still visibly different.
  - `StatusLineNC` makes window separators clear - I'd say yes, but
    depends on the eyes and monitor.
  - `StatuslineNC` is different from `CursorLine` - NO, they are same.

  Another approach to solve this would be to introduce dedicated
  `DiagnosticStatuslineXxx` groups to use in `vim.diagnostics.status()`.
  They can be defined using foreground colors from the same lightness as
  `Normal`. This would make them readable in `StatusLine`. But not
  `StatusLineNC`, though.
Diffstat:
Msrc/nvim/highlight_group.c | 8++++----
Mtest/functional/editor/defaults_spec.lua | 12++++++------
Mtest/functional/ex_cmds/swapfile_preserve_recover_spec.lua | 4++--
Mtest/functional/ui/embed_spec.lua | 4++--
4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c @@ -395,8 +395,8 @@ static const char *highlight_init_light[] = { "SpellCap guisp=NvimDarkYellow gui=undercurl cterm=undercurl", "SpellLocal guisp=NvimDarkGreen gui=undercurl cterm=undercurl", "SpellRare guisp=NvimDarkCyan gui=undercurl cterm=undercurl", - "StatusLine guifg=NvimLightGrey3 guibg=NvimDarkGrey3 cterm=reverse", - "StatusLineNC guifg=NvimDarkGrey2 guibg=NvimLightGrey4 cterm=bold,underline", + "StatusLine guifg=NvimDarkGrey2 guibg=NvimLightGrey4 cterm=reverse", + "StatusLineNC guifg=NvimDarkGrey3 guibg=NvimLightGrey3 cterm=bold,underline", "Title guifg=NvimDarkGrey2 gui=bold cterm=bold", "Visual guibg=NvimLightGrey4 ctermfg=15 ctermbg=0", "WarningMsg guifg=NvimDarkYellow ctermfg=3", @@ -481,8 +481,8 @@ static const char *highlight_init_dark[] = { "SpellCap guisp=NvimLightYellow gui=undercurl cterm=undercurl", "SpellLocal guisp=NvimLightGreen gui=undercurl cterm=undercurl", "SpellRare guisp=NvimLightCyan gui=undercurl cterm=undercurl", - "StatusLine guifg=NvimDarkGrey3 guibg=NvimLightGrey3 cterm=reverse", - "StatusLineNC guifg=NvimLightGrey2 guibg=NvimDarkGrey4 cterm=bold,underline", + "StatusLine guifg=NvimLightGrey2 guibg=NvimDarkGrey4 cterm=reverse", + "StatusLineNC guifg=NvimLightGrey3 guibg=NvimDarkGrey3 cterm=bold,underline", "Title guifg=NvimLightGrey2 gui=bold cterm=bold", "Visual guibg=NvimDarkGrey4 ctermfg=0 ctermbg=15", "WarningMsg guifg=NvimLightYellow ctermfg=11", diff --git a/test/functional/editor/defaults_spec.lua b/test/functional/editor/defaults_spec.lua @@ -100,8 +100,8 @@ describe('default', function() screen:set_default_attr_ids({ [1] = { foreground = Screen.colors.NvimDarkGray4 }, [2] = { - foreground = Screen.colors.NvimDarkGray3, - background = Screen.colors.NvimLightGray3, + foreground = Screen.colors.NvimLightGray2, + background = Screen.colors.NvimDarkGray4, }, [3] = { foreground = Screen.colors.NvimLightGrey1, @@ -179,8 +179,8 @@ describe('default', function() screen:set_default_attr_ids({ [1] = { foreground = Screen.colors.NvimDarkGrey4 }, [2] = { - background = Screen.colors.NvimLightGray3, - foreground = Screen.colors.NvimDarkGrey3, + background = Screen.colors.NvimDarkGrey4, + foreground = Screen.colors.NvimLightGray2, }, }) screen:expect({ @@ -199,8 +199,8 @@ describe('default', function() screen:set_default_attr_ids({ [1] = { foreground = Screen.colors.NvimDarkGray4 }, [2] = { - background = Screen.colors.NvimLightGrey3, - foreground = Screen.colors.NvimDarkGray3, + background = Screen.colors.NvimDarkGray4, + foreground = Screen.colors.NvimLightGrey2, }, [3] = { foreground = Screen.colors.NvimLightRed }, [4] = { foreground = Screen.colors.NvimLightCyan }, diff --git a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua @@ -220,8 +220,8 @@ pcall(vim.cmd.edit, 'Xtest_swapredraw.lua') [104] = { foreground = Screen.colors.NvimLightCyan }, [105] = { foreground = Screen.colors.NvimDarkGrey4 }, [106] = { - foreground = Screen.colors.NvimDarkGrey3, - background = Screen.colors.NvimLightGrey3, + foreground = Screen.colors.NvimLightGrey2, + background = Screen.colors.NvimDarkGrey4, }, [107] = { foreground = Screen.colors.NvimLightGrey2, bold = true }, [108] = { foreground = Screen.colors.NvimLightBlue }, diff --git a/test/functional/ui/embed_spec.lua b/test/functional/ui/embed_spec.lua @@ -30,8 +30,8 @@ local function test_embed(ext_linegrid) [100] = { foreground = Screen.colors.NvimDarkCyan }, [101] = { foreground = Screen.colors.NvimDarkRed }, [102] = { - background = Screen.colors.NvimDarkGrey3, - foreground = Screen.colors.NvimLightGrey3, + background = Screen.colors.NvimLightGrey4, + foreground = Screen.colors.NvimDarkGrey2, }, } end