norcalli / nvim-colorizer.lua

The fastest Neovim colorizer.
Other
2.23k stars 117 forks source link

Bug: Setup options not working #85

Closed k14lb3 closed 1 year ago

k14lb3 commented 2 years ago

Describe the bug Setup options not working.

Expected behavior All the setup options with false value should be disabled.

Screenshots image

Operating System: WSL Ubuntu 20.04.4 LTS

Neovim Version: 0.8.0-dev+532-g60604d6a9

Colorizer Version: 36c610a9717cc9ec426a07c8e6bf3b3abcb139d6

delightfulagony commented 2 years ago

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.
})
k14lb3 commented 2 years ago

It still doesn't work for me, unfortunately.

terminal

Rolv-Apneseth commented 1 year ago

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
korniychuk commented 1 year ago

https://github.com/NvChad/nvim-colorizer.lua

k14lb3 commented 1 year ago

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

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.

silly

james1236 commented 1 year ago

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

I think this behaviour is confusing

Rolv-Apneseth commented 1 year ago

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.

james1236 commented 1 year ago

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