nvim-colorizer.lua
nvim-colorizer.lua copied to clipboard
Bug: Nothing but hex colors works
Describe the bug
Only hex codes in the form of #abcdef
, #abc
and #abcdef00
are working.
To Reproduce I replaced my whole neovim configuration for this:
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
'--branch=stable', -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
local ok, lazy = pcall(require, 'lazy')
if not ok then
vim.notify('Could not require lazy!', vim.log.levels.ERROR)
vim.notify('Exiting from plugins/init.lua', vim.log.levels.ERROR)
return
end
lazy.setup({
{
'NvChad/nvim-colorizer.lua',
cmd = {
'ColorizerToggle',
'ColorizerAttachToBuffer',
'ColorizerDetachFromBuffer',
'ColorizerReloadAllBuffers',
},
config = function()
vim.opt.termguicolors = true
require('colorizer').setup({
filetypes = { 'conf' },
user_default_options = {
-- foreground, background, virtualtext
mode = 'background',
names = true,
RGB = true, -- #RGB hex codes
RRGGBB = true, -- #RRGGBB hex codes
RRGGBBAA = true, -- #RRGGBBAA hex codes
AARRGGBB = true, -- 0xAARRGGBB hex codes
rgb_fn = true, -- CSS rgb() and rgba() functions
hsl_fn = true, -- CSS hsl() and hsla() functions
css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn
-- Available methods are false / true / "normal" / "lsp" / "both"
-- True is same as normal
tailwind = true, -- Enable tailwind colors
-- parsers can contain values used in |user_default_options|
sass = { enable = true, parsers = { 'css' } }, -- Enable sass colors
virtualtext = '■',
},
})
end,
},
})
Expected behavior
When I open a file with things like rgb(123456)
, I expected it to be colored.
Screenshots If applicable, add screenshots to help explain your problem.
Operating System: Fedora 39
Neovim Version: 0.9.5
Colorizer Version: 85855b38011114929f4058efc97af1059ab3e41d
Here is a screenshot of a file I'm editing: