From 28ff4deda7a0c452d3a35de3da5e5ff676824915 Mon Sep 17 00:00:00 2001 From: Evgeni Chasnovski Date: Sat, 29 Nov 2025 19:36:05 +0200 Subject: [PATCH] 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. --- src/nvim/highlight_group.c | 8 ++++---- test/functional/editor/defaults_spec.lua | 12 ++++++------ .../ex_cmds/swapfile_preserve_recover_spec.lua | 4 ++-- test/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 index 2f219ecc11..d8c50bf7d5 100644 --- 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 index ca0951bb88..2a33a4fdaa 100644 --- 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 index 03bc750402..1a3f943057 100644 --- 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 index cf964f2e50..3dd7967b9f 100644 --- 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