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.
This commit is contained in:
Evgeni Chasnovski
2025-11-29 19:36:05 +02:00
committed by GitHub
parent a950e8ea9d
commit 28ff4deda7
4 changed files with 14 additions and 14 deletions

View File

@@ -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",

View File

@@ -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 },

View File

@@ -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 },

View File

@@ -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