Override highlight groups

  • Make sure you use a valid highlight group.
  • Check your theme colors in the base46 theme dir
  • To know which highlight groups are available, check the base46 integrations dir
  • Also if you just press tab key in hl_override, a list of highlight groups will show up via the completion menu.

When modifying the custom highlight groups in your theme file, such as "onedark.lua", it is important to note that only the variables from "base_30" can be used for this purpose.

Although hex colors can also be used in the "fg/bg" field, it is recommended to utilize the variable names (e.g. "blue", "darker_black", "one_bg", etc.) from your theme file as they will provide a better aesthetic. This way, there is no need to manually write the hex colors.

M.ui = {
   hl_override = {
      Pmenu = { bg = "white" },
      -- Pmenu = { bg = "#ffffff" }, this works too
        
      -- if you want to lighten or darken color
      -- this will use the black color from nvchad theme & lighten it by 2x
      -- use a negative number to darken it
      Normal = {
        bg = {"black", 2}
      },

      MyHighlightGroup = { -- custom highlights are also allowed
         fg = "red",
         bg = "darker_black"
      }
   },
}

In order to add custom highlights, it's the same as above, just use hl_add.

Customize themes

If you just want to customize an already existing theme, you can change the following configuration:

M.ui = {
   changed_themes = {
      onedark = {
         base_16 = {
            base00 = "#mycol",
         },
         base_30 = {
            red = "#mycol",
            white = "#mycol",
         },
      },

      nord = {
         -- and so on!
      },
   },
}

Local themes

WARNING: Do this at your own risk because you might not be able to make nice nvchad themes like siduck.
  • Default themes can be found in our base46 repository.

Here is the default structure for NvChad themes:

-- place the file in /themes/<theme-name>.lua
-- for example: /lua/themes/siduck.lua

local M = {}

M.base_30 = {
   -- 30 colors based on base_16
}

M.base_16 = {
   -- base16 colors
}

M.type = "dark" -- light / dark

return M

Finally, add your theme in chadrc.

M.ui = {
   theme = "siduck",
}

Integrations

M.base46 = {
  integrations = {
    "blankline",
    "cmp",
    "git",
    -- more
  }
}

  • Base46 uses the above table to compile highlight groups.
  • To load them, use the dofile function + full path of that highlight group cache file.
dofile(vim.g.base46_cache .. "cmp")

  • You can put the dofile code in your init.lua to make the highlight groups load by default, but in most cases you can just lazyload them like :
{
  "folke/trouble.nvim",
  cmd = "Trouble",
  config = function()
     dofile(vim.g.base46_cache .. "trouble")
     require("trouble").setup()
  end
}