Bug: Setup options not working
Closed this issue · 8 comments
Describe the bug
Setup options not working.
Expected behavior
All the setup options with false value should be disabled.
Operating System:
WSL Ubuntu 20.04.4 LTS
Neovim Version:
0.8.0-dev+532-g60604d6a9
Colorizer Version:
36c610a
Try changing { '*' }
for nil
, it worked for me.
Still, I think the { '*' }
should work but it doesn't work for me either while with nil
it does.
My setup code:
require 'colorizer'.setup(nil, {
RGB = true; -- #RGB hex codes
RRGGBB = true; -- #RRGGBB hex codes
names = false; -- "Name" codes like Blue
RRGGBBAA = true; -- #RRGGBBAA hex codes
rgb_fn = true; -- CSS rgb() and rgba() functions
hsl_fn = true; -- CSS hsl() and hsla() functions
css = false; -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
css_fn = false; -- Enable all CSS *functions*: rgb_fn, hsl_fn
-- Available modes: foreground, background
mode = 'background'; -- Set the display mode.
})
Just a guess as I'm not familiar with the codebase but if the options css=true
and css_fn=true
are set does that not mean that all other options are enabled regardless? Looking at these lines in the code
local enable_RGB = options.css or options.RGB
local enable_RRGGBB = options.css or options.RRGGBB
local enable_RRGGBBAA = options.css or options.RRGGBBAA
local enable_rgb = options.css or options.css_fns or options.rgb_fn
local enable_hsl = options.css or options.css_fns or options.hsl_fn
Try changing
{ '*' }
fornil
, it worked for me. Still, I think the{ '*' }
should work but it doesn't work for me either while withnil
it does.My setup code:
require 'colorizer'.setup(nil, { RGB = true; -- #RGB hex codes RRGGBB = true; -- #RRGGBB hex codes names = false; -- "Name" codes like Blue RRGGBBAA = true; -- #RRGGBBAA hex codes rgb_fn = true; -- CSS rgb() and rgba() functions hsl_fn = true; -- CSS hsl() and hsla() functions css = false; -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB css_fn = false; -- Enable all CSS *functions*: rgb_fn, hsl_fn -- Available modes: foreground, background mode = 'background'; -- Set the display mode. })
Just a guess as I'm not familiar with the codebase but if the options
css=true
andcss_fn=true
are set does that not mean that all other options are enabled regardless? Looking at these lines in the codelocal enable_RGB = options.css or options.RGB local enable_RRGGBB = options.css or options.RRGGBB local enable_RRGGBBAA = options.css or options.RRGGBBAA local enable_rgb = options.css or options.css_fns or options.rgb_fn local enable_hsl = options.css or options.css_fns or options.hsl_fn
Wait, silly me, so that's why it wasn't working. I probably forgot to read the comments in the code lol. Anyways, I guess it's fixed now. The only difference was using { '*' }
works for me.
Just a guess as I'm not familiar with the codebase but if the options
css=true
andcss_fn=true
are set does that not mean that all other options are enabled regardless? Looking at these lines in the codelocal enable_RGB = options.css or options.RGB local enable_RRGGBB = options.css or options.RRGGBB local enable_RRGGBBAA = options.css or options.RRGGBBAA local enable_rgb = options.css or options.css_fns or options.rgb_fn local enable_hsl = options.css or options.css_fns or options.hsl_fn
I think this behaviour is confusing
I think this behaviour is confusing
I agree, should probably just not have a css option in my opinion.
By the way I believe the currently maintained fork of this project, as shared above by @korniychuk, is here: https://github.com/NvChad/nvim-colorizer.lua
They still have the css option though so I just leave it as false.
I think this behaviour is confusing
I agree, should probably just not have a css option in my opinion.
By the way I believe the currently maintained fork of this project, as shared above by @korniychuk, is here: https://github.com/NvChad/nvim-colorizer.lua
They still have the css option though so I just leave it as false.
Thanks, a fix was just merged in that project for this issue, now single properties have priority over alias/group properties