diff options
| author | Evgeni Chasnovski <evgeni.chasnovski@gmail.com> | 2023-11-29 22:16:09 +0200 |
|---|---|---|
| committer | Evgeni Chasnovski <evgeni.chasnovski@gmail.com> | 2023-12-02 18:53:19 +0200 |
| commit | 64a14026d76ba1798d91e15a941fcb6af7cbc5ad (patch) | |
| tree | ff3a28704062e9393342a945b688b960c061d420 /test/functional | |
| parent | 17f3a3ae31d91944a5a4e56aa743745cff7fdf07 (diff) | |
| download | rneovim-64a14026d76ba1798d91e15a941fcb6af7cbc5ad.tar.gz rneovim-64a14026d76ba1798d91e15a941fcb6af7cbc5ad.tar.bz2 rneovim-64a14026d76ba1798d91e15a941fcb6af7cbc5ad.zip | |
feat(highlight): update default color scheme
Problem: Default color scheme is suboptimal.
Solution: Start using new color scheme. Introduce new `vim` color scheme
for opt-in backward compatibility.
------
Main design ideas
- Be "Neovim branded".
- Be minimal for 256 colors with a bit more shades for true colors.
- Be accessible through high enough contrast ratios.
- Be suitable for dark and light backgrounds via exchange of dark and
light palettes.
------
Palettes
- Have dark and light variants. Implemented through exporeted
`NvimDark*` and `NvimLight*` hex colors.
- Palettes have 4 shades of grey for UI elements and 6 colors (red,
yellow, green, cyan, blue, magenta).
- Actual values are computed procedurally in Oklch color space based on
a handful of hyperparameters.
- Each color has a 256 colors variant with perceptually closest color.
------
Highlight groups
Use:
- Grey shades for general UI according to their design.
- Bold text for keywords (`Statement` highlight group). This is an
important choice to increase accessibility for people with color
deficiencies, as it doesn't rely on actual color.
- Green for strings, `DiffAdd` (as background), `DiagnosticOk`, and some
minor text UI elements.
- Cyan as main syntax color, i.e. for function usage (`Function`
highlight group), `DiffText`, `DiagnosticInfo`, and some minor text UI
elements.
- Red to generally mean high user attention, i.e. errors; in particular
for `ErrorMsg`, `DiffDelete`, `DiagnosticError`.
- Yellow very sparingly only with true colors to mean mild user
attention, i.e. warnings. That is, `DiagnosticWarn` and `WarningMsg`.
- Blue very sparingly only with true colors as `DiagnosticHint` and some
additional important syntax group (like `Identifier`).
- Magenta very carefully (if at all).
------
Notes
- To make tests work without relatively larege updates, each one is
prepended with an equivalent of the call `:colorscheme vim`.
Plus some tests which spawn new Neovim instances also now use 'vim'
color scheme.
In some cases tests are updated to fit new default color scheme.
Diffstat (limited to 'test/functional')
| -rw-r--r-- | test/functional/api/highlight_spec.lua | 2 | ||||
| -rw-r--r-- | test/functional/autocmd/focus_spec.lua | 6 | ||||
| -rw-r--r-- | test/functional/core/main_spec.lua | 19 | ||||
| -rw-r--r-- | test/functional/helpers.lua | 5 | ||||
| -rw-r--r-- | test/functional/terminal/api_spec.lua | 2 | ||||
| -rw-r--r-- | test/functional/terminal/buffer_spec.lua | 6 | ||||
| -rw-r--r-- | test/functional/terminal/cursor_spec.lua | 661 | ||||
| -rw-r--r-- | test/functional/terminal/tui_spec.lua | 67 | ||||
| -rw-r--r-- | test/functional/ui/cursor_spec.lua | 2 | ||||
| -rw-r--r-- | test/functional/ui/embed_spec.lua | 36 | ||||
| -rw-r--r-- | test/functional/ui/float_spec.lua | 10 | ||||
| -rw-r--r-- | test/functional/ui/hlstate_spec.lua | 2 | ||||
| -rw-r--r-- | test/functional/ui/output_spec.lua | 2 | ||||
| -rw-r--r-- | test/functional/ui/quickfix_spec.lua | 6 | ||||
| -rw-r--r-- | test/functional/ui/screen_basic_spec.lua | 26 |
15 files changed, 459 insertions, 393 deletions
diff --git a/test/functional/api/highlight_spec.lua b/test/functional/api/highlight_spec.lua index 7d7d07e30e..c9edbf825d 100644 --- a/test/functional/api/highlight_spec.lua +++ b/test/functional/api/highlight_spec.lua @@ -561,7 +561,7 @@ describe('API: get highlight', function() end) it('can correctly detect links', function() - command('hi String guifg=#a6e3a1') + command('hi String guifg=#a6e3a1 ctermfg=NONE') command('hi link @string string') command('hi link @string.cpp @string') eq({ fg = 10937249 }, meths.get_hl(0, { name = 'String' })) diff --git a/test/functional/autocmd/focus_spec.lua b/test/functional/autocmd/focus_spec.lua index 33e4d88c7b..c72842f14b 100644 --- a/test/functional/autocmd/focus_spec.lua +++ b/test/functional/autocmd/focus_spec.lua @@ -14,8 +14,10 @@ describe('autoread TUI FocusGained/FocusLost', function() before_each(function() clear() - screen = thelpers.screen_setup(0, '["'..nvim_prog - ..'", "-u", "NONE", "-i", "NONE", "--cmd", "set noswapfile noshowcmd noruler"]') + screen = thelpers.screen_setup( + 0, + '["'..nvim_prog..'", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim", "--cmd", "set noswapfile noshowcmd noruler"]' + ) end) teardown(function() diff --git a/test/functional/core/main_spec.lua b/test/functional/core/main_spec.lua index 19c7a93730..d705d56575 100644 --- a/test/functional/core/main_spec.lua +++ b/test/functional/core/main_spec.lua @@ -70,17 +70,18 @@ describe('command-line option', function() -- data from the terminal #18181 funcs.termopen(string.format([[echo "" | %s]], table.concat(args, " "))) screen:expect([[ - ^ | - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {2:[No Name] 0,0-1 All}| - | + {1:^ }| + {2:~ }| + {2:~ }| + {2:~ }| + {2:~ }| + {3:[No Name] 0,0-1 All}| + {1: }| | ]], { - [1] = {foreground = tonumber('0x4040ff'), fg_indexed=true}, - [2] = {bold = true, reverse = true} + [1] = {bg_indexed = true, foreground = Screen.colors.Grey91, background = tonumber('0x161616'), fg_indexed = true}, + [2] = {bg_indexed = true, foreground = Screen.colors.Gray30, background = tonumber('0x161616'), fg_indexed = true}, + [3] = {bg_indexed = true, foreground = tonumber('0xd2d2d2'), background = Screen.colors.Black , fg_indexed = true}, }) feed('i:cq<CR>') screen:expect([[ diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index dcaaa664b9..2bff1d16f8 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -38,6 +38,11 @@ module.nvim_argv = { '--cmd', module.nvim_set, '--cmd', 'mapclear', '--cmd', 'mapclear!', + -- Make screentest work after changing to the new default color scheme + -- Source 'vim' color scheme without side effects + -- TODO: rewrite tests + '--cmd', 'lua f=io.open("runtime/colors/vim.vim", "r"); l=f:read("*a"); f:close(); vim.api.nvim_exec2(l, {})', + '--cmd', 'unlet g:colors_name', '--embed'} -- Directory containing nvim. diff --git a/test/functional/terminal/api_spec.lua b/test/functional/terminal/api_spec.lua index 93641fc576..c278b2ad0e 100644 --- a/test/functional/terminal/api_spec.lua +++ b/test/functional/terminal/api_spec.lua @@ -12,7 +12,7 @@ describe('api', function() helpers.clear() os.remove(socket_name) screen = child_session.screen_setup(0, '["'..helpers.nvim_prog - ..'", "-u", "NONE", "-i", "NONE", "--cmd", "'..helpers.nvim_set..'"]') + ..'", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim", "--cmd", "'..helpers.nvim_set..'"]') end) after_each(function() os.remove(socket_name) diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua index 6d8c214d87..423e7bdf21 100644 --- a/test/functional/terminal/buffer_spec.lua +++ b/test/functional/terminal/buffer_spec.lua @@ -446,8 +446,10 @@ end) describe('terminal input', function() it('sends various special keys with modifiers', function() clear() - local screen = thelpers.screen_setup(0, - string.format([=[["%s", "-u", "NONE", "-i", "NONE", "--cmd", "startinsert"]]=], nvim_prog)) + local screen = thelpers.screen_setup( + 0, + string.format([=[["%s", "-u", "NONE", "-i", "NONE", "--cmd", 'colorscheme vim', "--cmd", "startinsert"]]=], nvim_prog) + ) screen:expect{grid=[[ {1: } | {4:~ }| diff --git a/test/functional/terminal/cursor_spec.lua b/test/functional/terminal/cursor_spec.lua index 8285bcc26e..95081b7189 100644 --- a/test/functional/terminal/cursor_spec.lua +++ b/test/functional/terminal/cursor_spec.lua @@ -188,16 +188,22 @@ describe('buffer cursor position is correct in terminal without number column', ..[[", "-u", "NONE", "-i", "NONE", "-E", "--cmd", "let @r = ']]..str..[['", ]] -- <Left> and <Right> don't always work ..[["--cmd", "cnoremap <C-X> <Left>", "--cmd", "cnoremap <C-O> <Right>"]]..']', 70) + screen:set_default_attr_ids({ + [1] = {foreground = 253, background = 11}; + [3] = {bold = true}, + [16] = {background = 234, foreground = 253}; + [17] = {reverse = true, background = 234, foreground = 253}; + }) -- Also check for real cursor position, as it is used for stuff like input methods screen._handle_busy_start = function() end screen._handle_busy_stop = function() end screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :{1:^ } | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::}{17:^ }{16: }| {3:-- TERMINAL --} | ]]) end @@ -212,23 +218,23 @@ describe('buffer cursor position is correct in terminal without number column', it('at the end', function() feed('<C-R>r') screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :aaaaaaaa{1:^ } | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::aaaaaaaa}{17:^ }{16: }| {3:-- TERMINAL --} | ]]) eq({6, 9}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :aaaaaaa^a{2: } | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::aaaaaaa^a}{1: }{16: }| | ]]) eq({6, 8}, eval('nvim_win_get_cursor(0)')) @@ -237,23 +243,23 @@ describe('buffer cursor position is correct in terminal without number column', it('near the end', function() feed('<C-R>r<C-X><C-X>') screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :aaaaaa{1:^a}a | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::aaaaaa}{17:^a}{16:a }| {3:-- TERMINAL --} | ]]) eq({6, 7}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :aaaaa^a{2:a}a | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::aaaaa^a}{1:a}{16:a }| | ]]) eq({6, 6}, eval('nvim_win_get_cursor(0)')) @@ -262,23 +268,23 @@ describe('buffer cursor position is correct in terminal without number column', it('near the start', function() feed('<C-R>r<C-B><C-O>') screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :a{1:^a}aaaaaa | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::a}{17:^a}{16:aaaaaa }| {3:-- TERMINAL --} | ]]) eq({6, 2}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :^a{2:a}aaaaaa | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::^a}{1:a}{16:aaaaaa }| | ]]) eq({6, 1}, eval('nvim_win_get_cursor(0)')) @@ -293,23 +299,23 @@ describe('buffer cursor position is correct in terminal without number column', it('at the end', function() feed('<C-R>r') screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :µµµµµµµµ{1:^ } | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::µµµµµµµµ}{17:^ }{16: }| {3:-- TERMINAL --} | ]]) eq({6, 17}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :µµµµµµµ^µ{2: } | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::µµµµµµµ^µ}{1: }{16: }| | ]]) eq({6, 15}, eval('nvim_win_get_cursor(0)')) @@ -318,23 +324,23 @@ describe('buffer cursor position is correct in terminal without number column', it('near the end', function() feed('<C-R>r<C-X><C-X>') screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :µµµµµµ{1:^µ}µ | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::µµµµµµ}{17:^µ}{16:µ }| {3:-- TERMINAL --} | ]]) eq({6, 13}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :µµµµµ^µ{2:µ}µ | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::µµµµµ^µ}{1:µ}{16:µ }| | ]]) eq({6, 11}, eval('nvim_win_get_cursor(0)')) @@ -343,23 +349,23 @@ describe('buffer cursor position is correct in terminal without number column', it('near the start', function() feed('<C-R>r<C-B><C-O>') screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :µ{1:^µ}µµµµµµ | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::µ}{17:^µ}{16:µµµµµµ }| {3:-- TERMINAL --} | ]]) eq({6, 3}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :^µ{2:µ}µµµµµµ | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::^µ}{1:µ}{16:µµµµµµ }| | ]]) eq({6, 1}, eval('nvim_win_get_cursor(0)')) @@ -376,23 +382,23 @@ describe('buffer cursor position is correct in terminal without number column', it('at the end', function() feed('<C-R>r') screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :µ̳µ̳µ̳µ̳µ̳µ̳µ̳µ̳{1:^ } | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::µ̳µ̳µ̳µ̳µ̳µ̳µ̳µ̳}{17:^ }{16: }| {3:-- TERMINAL --} | ]]) eq({6, 33}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :µ̳µ̳µ̳µ̳µ̳µ̳µ̳^µ̳{2: } | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::µ̳µ̳µ̳µ̳µ̳µ̳µ̳^µ̳}{1: }{16: }| | ]]) eq({6, 29}, eval('nvim_win_get_cursor(0)')) @@ -401,23 +407,23 @@ describe('buffer cursor position is correct in terminal without number column', it('near the end', function() feed('<C-R>r<C-X><C-X>') screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :µ̳µ̳µ̳µ̳µ̳µ̳{1:^µ̳}µ̳ | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::µ̳µ̳µ̳µ̳µ̳µ̳}{17:^µ̳}{16:µ̳ }| {3:-- TERMINAL --} | ]]) eq({6, 25}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :µ̳µ̳µ̳µ̳µ̳^µ̳{2:µ̳}µ̳ | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::µ̳µ̳µ̳µ̳µ̳^µ̳}{1:µ̳}{16:µ̳ }| | ]]) eq({6, 21}, eval('nvim_win_get_cursor(0)')) @@ -426,23 +432,23 @@ describe('buffer cursor position is correct in terminal without number column', it('near the start', function() feed('<C-R>r<C-B><C-O>') screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :µ̳{1:^µ̳}µ̳µ̳µ̳µ̳µ̳µ̳ | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::µ̳}{17:^µ̳}{16:µ̳µ̳µ̳µ̳µ̳µ̳ }| {3:-- TERMINAL --} | ]]) eq({6, 5}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :^µ̳{2:µ̳}µ̳µ̳µ̳µ̳µ̳µ̳ | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::^µ̳}{1:µ̳}{16:µ̳µ̳µ̳µ̳µ̳µ̳ }| | ]]) eq({6, 1}, eval('nvim_win_get_cursor(0)')) @@ -459,23 +465,23 @@ describe('buffer cursor position is correct in terminal without number column', it('at the end', function() feed('<C-R>r') screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :哦哦哦哦哦哦哦哦{1:^ } | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::哦哦哦哦哦哦哦哦}{17:^ }{16: }| {3:-- TERMINAL --} | ]]) eq({6, 25}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :哦哦哦哦哦哦哦^哦{2: } | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::哦哦哦哦哦哦哦^哦}{1: }{16: }| | ]]) eq({6, 22}, eval('nvim_win_get_cursor(0)')) @@ -484,23 +490,23 @@ describe('buffer cursor position is correct in terminal without number column', it('near the end', function() feed('<C-R>r<C-X><C-X>') screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :哦哦哦哦哦哦{1:^哦}哦 | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::哦哦哦哦哦哦}{17:^哦}{16:哦 }| {3:-- TERMINAL --} | ]]) eq({6, 19}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :哦哦哦哦哦^哦{2:哦}哦 | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::哦哦哦哦哦^哦}{1:哦}{16:哦 }| | ]]) eq({6, 16}, eval('nvim_win_get_cursor(0)')) @@ -509,23 +515,23 @@ describe('buffer cursor position is correct in terminal without number column', it('near the start', function() feed('<C-R>r<C-B><C-O>') |