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: default_user_settings not applied for 'names' #44

Closed
ehaynes99 opened this issue Jan 17, 2023 · 4 comments
Closed

Bug: default_user_settings not applied for 'names' #44

ehaynes99 opened this issue Jan 17, 2023 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@ehaynes99
Copy link

Describe the bug
When setting names = false in default_user_settings, color names are still highlighted. It works correctly if specified for the particular filetype, just not the defaults. I'll try to dig into more this evening.

To Reproduce

local colorizer = require('colorizer')

-- red blue green
colorizer.setup({
  default_user_settings = {
    names = false,
  },
  filetypes = {
    'css',
    'html',
    'typescriptreact',
    'lua',
  },
})

Expected behavior
Color names would not be highlighted.

Screenshots
image
image

Operating System:
Arch Linux

Neovim Version:
NVIM v0.8.2

Colorizer Version:
760e27df4dd966607e8fb7fd8b6b93e3c7d2e193

@ehaynes99 ehaynes99 added the bug Something isn't working label Jan 17, 2023
@nonetallt
Copy link

Make sure you're using the correct key for your configuration. You're using default_user_settings while the one advertised in readme.md is called user_default_options.

I also had an issue with the names option before I realized I wasn't using the correct keys (in my case I tried to set names at the top level instead of the correct default_user_settings key.

@Dich0tomy
Copy link

@nonetallt I have it set to user_default_options but it still doesnt work:

      colorizer.setup({
        user_default_options = {
          RGB = true, -- #RGB hex codes
          RRGGBB = true, -- #RRGGBB hex codes
          names = false, -- "Name" codes like Blue or blue
          RRGGBBAA = true, -- #RRGGBBAA hex codes
          AARRGGBB = false, -- 0xAARRGGBB 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 = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn
          mode = "background", -- Set the display mode.
          virtualtext = "",
        },
      })

I still see names highlighted

@ehaynes99
Copy link
Author

Hrmm, I have no idea where I got that... It does indeed work for me. @B4mbus I'm not sure what would be going on with yours. The place where it's determined is here:
https://github.com/NvChad/nvim-colorizer.lua/blob/master/lua/colorizer/matcher.lua#L71

Which, for some reason, also checks the css property, but I see you have that set to false as well.

@gennaro-tedesco
Copy link

I am having the same problem: names = false does not work (reproducing the same problem of the original plugin).

Likewise, it seems that the plugin does not attach to files automatically, rather it must be manually toggled all the times: perhaps this depends by how certain package managers (lazy.nvim in this case) load the configuration options?

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

5 participants