How To Edit A Colorbuddy Based Colortheme For Neovim

Publish Date - 10th April 2023

Last Updated - 10th April 2023

As programmers we often spend many hours on our computers. either inside a terminal or a coding environment. It's important to build an environment that we enjoy being in.

To that end, I like to play around with my color themes. Because it's fun?

I recently started using a colorbuddy based colortheme. Colorbuddy is a framework you can use to easily create color themes with lua.

Maybe you are not interested in creating a theme. Neither am I. But you can edit an existing theme. Here is how:

Disable Treesitter First

The first thing you need to do is disable treesitter for markdown files:

require 'nvim-treesitter.configs'.setup {
  ensure_installed = {
  -- other configs here
  highlight {
    enable = true,
    disable = {"markdown"} -- <-- this is key

If you don't disable treesitter for markdown, none of the changes you make for markdown will take effect.

Find the name of the group you wish to Change

Everything in neovim is a group. Prior to neovim v0.9, there is no easy way to discover the right highlight group you need to reference.

For example the headline text color for H1 in markdown is markdownH1

I discovered this by looking at example color themes based on color buddy. To do this, go to the colorbuddy github repo and look inside:


Look for the markdown.lua file. Inside you will the the group name for header 1,2 and 3

For example, header 2 is call markdownH2

In neovim 0.9, you can put your cursor over the element you want to inspect and type :Inspect.

Find the color theme you want to change on mac

Color themes are stored in .local/share/nvim/site/pack/packer/start/

Find the theme plugin and look for the lua file.

These files are already setup. You do not need to create new variables or functions. Just use the conventions setup by the theme.

Add a new color

Using the neosolarized.lua theme as an example, to add a color, I did:'lightBlue', "#ADD8E6")

Assign the color to the highlight group

I wanted to change the headline color for markdown H2

So I added the groups:"markdownH2", colors.lightBlue, nil, opts)

Thats it. Bye for now.