1
I can see color on those:
#000000
red


But not on those:
rgb(0,45,65);
rgba(2,45,23,1);

Here is C:\Users\user\AppData\Local\nvim\lua\plugins\init.lua file colorizer code that comes preinstalled with nvChad:

  {
    "NvChad/nvim-colorizer.lua",
    init = function()
      require("core.utils").lazy_load "nvim-colorizer.lua"
    end,
    config = function(_, opts)
      require("colorizer").setup(opts)

      -- execute colorizer as soon as possible
      vim.defer_fn(function()
        require("colorizer").attach_to_buffer(0)
      end, 0)
    end,
  },

I don't know how to configure it. Ive seen people try to add this:

 local custom_options = {
      mode = "background", -- You can change the mode to "foreground" to colorize foreground color codes
      RGB = true, -- Enable RGB color notation support
      RRGGBB = true, -- Enable RRGGBB color notation support
      names = false, -- Disable color name highlighting (e.g., "red", "blue", etc.)
      css = false, -- Disable CSS color notation support
    }

But I don't know lua and couldn't find any way to add those settings to it.

1
  • Did the solution provided solved your problem? How can we help you further? If it does may be could you accept it using the v button next to the arrow voting buttons. It all the question to rest :-) Aug 17, 2023 at 11:43

1 Answer 1

1

I would adapt the nvim/lua/custom/plugins.lua And make sure the plugins table contains the following section:

  {
    "NvChad/nvim-colorizer.lua",
    opts = {
        filetypes = { "*" },
        user_default_options = {
          RGB = true, -- #RGB hex codes
          RRGGBB = true, -- #RRGGBB hex codes
          names = true, -- "Name" codes like Blue or blue
          RRGGBBAA = false, -- #RRGGBBAA hex codes
          AARRGGBB = false, -- 0xAARRGGBB hex codes
          rgb_fn = true, -- CSS rgb() and rgba() functions
          hsl_fn = false, -- 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 for `mode`: foreground, background,  virtualtext
          mode = "background", -- Set the display mode.
          -- Available methods are false / true / "normal" / "lsp" / "both"
          -- True is same as normal
          tailwind = false, -- Enable tailwind colors
          -- parsers can contain values used in |user_default_options|
          sass = { enable = false, parsers = { "css" }, }, -- Enable sass colors
          virtualtext = "■",
          -- update color values even if buffer is not focused
          -- example use: cmp_menu, cmp_docs
          always_update = false
        },
        -- all the sub-options of filetypes apply to buftypes
        buftypes = {},
    }
  },

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.