nvim-colorizer.lua icon indicating copy to clipboard operation
nvim-colorizer.lua copied to clipboard

[Bug Report] ColorizerToggle doesn't work after switching colorscheme

Open laggardkernel opened this issue 4 years ago • 9 comments

Describe the bug I'm using the vim-one colorscheme. Just found after switching background from light to dark, the color highlight is lost.

Command ColorizerToggle works well before changing the background value, but not after that.

Environments

  • Neovim: 0.4.4
  • nvim-colorizer.lua: 36c610a9717cc9ec426a07c8e6bf3b3abcb139d6

laggardkernel avatar May 16 '21 05:05 laggardkernel

I got the same problem. Is anybody here?

nyngwang avatar Oct 28 '21 18:10 nyngwang

See also #91.

This repo seems no longer maintained; use this fork instead: https://github.com/NvChad/nvim-colorizer.lua

wookayin avatar Apr 25 '23 18:04 wookayin

@wookayin I would like to know about your choice between that maintained fork and this one I'm using. (I found the latter after my last reply. It currently has some trouble regarding large files)

update: Oh sorry, I must be blind in that it is clearly documented there and I didn't see it.

nyngwang avatar Apr 25 '23 19:04 nyngwang

NvChad's one seems much better and well supported (and more community users). I quickly tried the one you pointed (nvim-highlight-colors) but I find that quite buggy, and I think nvim-colorizer.lua is a superset in terms of features and functionalities.

wookayin avatar Apr 25 '23 19:04 wookayin

@wookayin But I just tried the one maintained by NvChad, which unfortunately seems buggy regarding the toggle ColorizerToggle. After toggling it off, it's impossible (at least on my machine) to re-enable it using either ColorizerToggle again or ColorizerAttachToBuffer.

This is the code I'm using for your reference:

  -- use {
  --   'NvChad/nvim-colorizer.lua',
  --   config = function ()
  --     require('colorizer').setup {
  --       user_default_options = {
  --         names = false,
  --         css_fn = true, -- Enable all CSS functions: rgb_fn, hsl_fn
  --       }
  --     }
  --     vim.keymap.set('n', '<Leader>ah', function () vim.cmd('ColorizerToggle') end)
  --     -- vim.api.nvim_create_autocmd({ 'ColorScheme' }, {
  --     --   pattern = '*',
  --     --   callback = function () vim.cmd('HighlightColorsOn') end
  --     -- })
  --   end
  -- }
  use {
    'brenoprata10/nvim-highlight-colors',
    config = function ()
      require('nvim-highlight-colors').setup {
        render = 'background',
        enable_named_colors = true,
        enable_tailwind = false
      }
      vim.keymap.set('n', '<Leader>ah', function () vim.cmd('HighlightColorsToggle') end)
      vim.api.nvim_create_autocmd({ 'ColorScheme' }, {
        pattern = '*',
        callback = function () vim.cmd('HighlightColorsOn') end
      })
    end
  }

nyngwang avatar Apr 25 '23 19:04 nyngwang

@wookayin I would like to know about your choice between that maintained fork and this one I'm using. (I found the latter after my last reply. It currently has some trouble regarding large files)

update: Oh sorry, I must be blind in that it is clearly documented there and I didn't see it.

Just to clarify, my plugin (nvim-highlight-colors) is not a fork, I built it from scratch 😄

brenoprata10 avatar Apr 26 '23 09:04 brenoprata10

@brenoprata10 No worries, I meant NvChad one when I wrote "that maintained fork".

nyngwang avatar Apr 26 '23 14:04 nyngwang

Experiencing same issue. But I see recent (2 m.o.) activity in this repo, is it really unmaintained?

Galicarnax avatar Jul 20 '24 09:07 Galicarnax

Sorry just woke up from a metaphorical coma. I'll take a peek at reproducing this. Hopefully it's an easy fix.

norcalli avatar Jul 21 '24 00:07 norcalli