Bug: Colorization issue in a WhichKey buffer
louis-vinchon opened this issue · 0 comments
Describe the bug
I wanted Colorizer to highlight color codes in a WhichKey menu, but the behavior differs from a "regular file buffer".
To Reproduce
Minimal NVIM configuration using packer:
local status_ok, packer = pcall(require, "packer")
if not status_ok then
return
end
vim.opt.termguicolors = true
vim.opt.timeoutlen = 0
vim.g.tokyonight_style = "night"
packer.startup(function(use)
use "folke/which-key.nvim"
use "norcalli/nvim-colorizer.lua"
use "folke/tokyonight.nvim"
end)
-- Colorscheme config.
vim.cmd [[
try
colorscheme tokyonight
catch /^Vim\%((\a\+)\)\=:E185/
colorscheme default
set background=dark
endtry
]]
-- Leader key map.
vim.api.nvim_set_keymap("", "<Space>", "<Nop>", { noremap = true, silent = true })
vim.g.mapleader = " "
vim.g.maplocalleader = " "
-- WhichKey config.
local wk = require("which-key")
wk.register({
t = {
"<cmd>echo 'test'<CR>",
"#7FFFD4",
},
}, { prefix = "<leader>" })
-- Colorizer config.
require("colorizer").setup({
"WhichKey",
})
In any buffer, in normal mode, use the <leader>
key (in the above configuration, that would be
"space") and a pop-up window should shortly appear and tell you which follow up keys are
available. There should be only one: "t", with a help message that is a color code. I wanted
that color code to be highlighted.
Expected behavior
Colorizer applies the highlight like in any other buffer.
Actual behavior
While the background is of the correct color, the foreground does not seem to have changed, and
makes the text hard to read depending on the background color.
Screenshots
As you can see in the second screenshot, I have the color code highlighted in
the WhichKey menu, and I have the same color code highlighted in the file
buffer to make the difference obvious: it is perfectly legible in the file,
but it is kinda hard to read in the menu because of the foreground color that
didn't change.
Operating System:
Linux arch 5.16.14-arch1-1
Neovim Version:
NVIM v0.6.1
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by builduser
Features: +acl +iconv +tui
Colorizer Version:
Commit 36c610a