Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Colorization issue in a WhichKey buffer #78

Open
louis-vinchon opened this issue Mar 16, 2022 · 0 comments
Open

Bug: Colorization issue in a WhichKey buffer #78

louis-vinchon opened this issue Mar 16, 2022 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@louis-vinchon
Copy link

louis-vinchon commented Mar 16, 2022

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

Behavior without colorizer:
Behavior without colorizer

Behavior with colorizer:
Behavior with colorizer

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

Additional context

@louis-vinchon louis-vinchon added the bug Something isn't working label Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants