catppuccin/nvim

github github
colorschemetreesitter-colorschemes
stars 4,671
issues 10
subscribers 18
forks 209
CREATED

2021-08-18

UPDATED

11 days ago


Flavours

Bake your own flavour! Here are some config from our community: (background source)

nvimwalk-custom

Features

Installation

lazy.nvim

{ "catppuccin/nvim", name = "catppuccin", priority = 1000 }

packer.nvim

use { "catppuccin/nvim", as = "catppuccin" }

vim-plug

Plug 'catppuccin/nvim', { 'as': 'catppuccin' }

Usage

colorscheme catppuccin " catppuccin-latte, catppuccin-frappe, catppuccin-macchiato, catppuccin-mocha
vim.cmd.colorscheme "catppuccin"

Configuration

There is no need to call setup if you don't want to change the default options and settings.

require("catppuccin").setup({
    flavour = "auto", -- latte, frappe, macchiato, mocha
    background = { -- :h background
        light = "latte",
        dark = "mocha",
    },
    transparent_background = false, -- disables setting the background color.
    show_end_of_buffer = false, -- shows the '~' characters after the end of buffers
    term_colors = false, -- sets terminal colors (e.g. `g:terminal_color_0`)
    dim_inactive = {
        enabled = false, -- dims the background color of inactive window
        shade = "dark",
        percentage = 0.15, -- percentage of the shade to apply to the inactive window
    },
    no_italic = false, -- Force no italic
    no_bold = false, -- Force no bold
    no_underline = false, -- Force no underline
    styles = { -- Handles the styles of general hi groups (see `:h highlight-args`):
        comments = { "italic" }, -- Change the style of comments
        conditionals = { "italic" },
        loops = {},
        functions = {},
        keywords = {},
        strings = {},
        variables = {},
        numbers = {},
        booleans = {},
        properties = {},
        types = {},
        operators = {},
        -- miscs = {}, -- Uncomment to turn off hard-coded styles
    },
    color_overrides = {},
    custom_highlights = {},
    default_integrations = true,
    integrations = {
        cmp = true,
        gitsigns = true,
        nvimtree = true,
        treesitter = true,
        notify = false,
        mini = {
            enabled = true,
            indentscope_color = "",
        },
        -- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations)
    },
})

-- setup must be called before loading
vim.cmd.colorscheme "catppuccin"

Customize highlights

Get catppuccin colors

local latte = require("catppuccin.palettes").get_palette "latte"
local frappe = require("catppuccin.palettes").get_palette "frappe"
local macchiato = require("catppuccin.palettes").get_palette "macchiato"
local mocha = require("catppuccin.palettes").get_palette "mocha"

Returns a table where the key is the name of the color and the value is its hex value corresponding to each flavour.

Overwriting colors

Colors can be overwritten using color_overrides in the setting, checkout https://github.com/catppuccin/nvim/discussions/323 for inspirations:

require("catppuccin").setup {
    color_overrides = {
        all = {
            text = "#ffffff",
        },
        latte = {
            base = "#ff0000",
            mantle = "#242424",
            crust = "#474747",
        },
        frappe = {},
        macchiato = {},
        mocha = {},
    }
}

[!Note] For more information check out our style-guide

Overwriting highlight groups

Global highlight groups can be overwritten in the setting, for example:

require("catppuccin").setup {
    custom_highlights = function(colors)
        return {
            Comment = { fg = colors.flamingo },
            TabLineSel = { bg = colors.pink },
            CmpBorder = { fg = colors.surface2 },
            Pmenu = { bg = colors.none },
        }
    end
}

Per flavour highlight groups can also be overwritten in the setting, for example:

require("catppuccin").setup {
    highlight_overrides = {
        all = function(colors)
            return {
                NvimTreeNormal = { fg = colors.none },
                CmpBorder = { fg = "#3e4145" },
            }
        end,
        latte = function(latte)
            return {
                Normal = { fg = latte.base },
            }
        end,
        frappe = function(frappe)
            return {
                ["@comment"] = { fg = frappe.surface2, style = { "italic" } },
            }
        end,
        macchiato = function(macchiato)
            return {
                LineNr = { fg = macchiato.overlay1 },
            }
        end,
        mocha = function(mocha)
            return {
                Comment = { fg = mocha.flamingo },
            }
        end,
    },
}

Integrations

Catppuccin provides theme support for other plugins in the Neovim ecosystem and extended Neovim functionality through integrations.

To enable/disable an integration you just need to set it to true/false, for example:

require("catppuccin").setup({
    integrations = {
        cmp = true,
        gitsigns = true,
        nvimtree = true,
        treesitter = true,
        notify = false,
        mini = {
            enabled = true,
            indentscope_color = "",
        },
    }
})

Some integrations are enabled by default, you can control this behaviour with default_integrations option.

require("catppuccin").setup({
    default_integrations = false,
})

Below is a list of supported plugins and their corresponding integration module.

[!Important] If you'd like to know which highlight groups are being affected by catppuccin, check out this directory: lua/catppuccin/groups/integrations/.

aerial = false
alpha = true
barbar = false
barbecue = {
    dim_dirname = true, -- directory name is dimmed by default
    bold_basename = true,
    dim_context = false,
    alt_background = false,
},

Use this to set it up:

require("barbecue").setup {
  theme = "catppuccin", -- catppuccin-latte, catppuccin-frappe, catppuccin-macchiato, catppuccin-mocha
}
beacon = false

Update your bufferline config to use the Catppuccin components:

[!NOTE] bufferline needs to be loaded after setting up catppuccin or it will highlight incorrectly

use "akinsho/bufferline.nvim" {
  after = "catppuccin",
  config = function()
    require("bufferline").setup {
      highlights = require("catppuccin.groups.integrations.bufferline").get()
    }
  end
}

Configurations are self-explanatory, see :h bufferline-highlights for detailed explanations:

local mocha = require("catppuccin.palettes").get_palette "mocha"
bufferline.setup {
    highlights = require("catppuccin.groups.integrations.bufferline").get {
        styles = { "italic", "bold" },
        custom = {
            all = {
                fill = { bg = "#000000" },
            },
            mocha = {
                background = { fg = mocha.text },
            },
            latte = {
                background = { fg = "#000000" },
            },
        },
    },
}
coc_nvim = false

Setting enabled to true enables this integration.

coc_nvim = true,

[!Note] coc.nvim by default link to native lsp highlight groups so config from native_lsp will also apply to coc

In the inners tables you can set the style for the diagnostics, both virtual_text (what you see on the side) and underlines (what points directly at the thing (e.g. an error)).

native_lsp = {
    enabled = true,
    virtual_text = {
        errors = { "italic" },
        hints = { "italic" },
        warnings = { "italic" },
        information = { "italic" },
    },
    underlines = {
        errors = { "underline" },
        hints = { "underline" },
        warnings = { "underline" },
        information = { "underline" },
    },
    inlay_hints = {
        background = true,
    },
},
dashboard = true
dropbar = {
    enabled = false,
    color_mode = false, -- enable color for kind's texts, not just kind's icons
},

Update your Feline config to use the Catppuccin components:

local ctp_feline = require('catppuccin.groups.integrations.feline')

ctp_feline.setup()

require("feline").setup({
    components = ctp_feline.get(),
})

Notice that calling setup() is optional. You may pass a lua table in order to change assets, settings and the colors per vim mode.

Here are the defaults:

local clrs = require("catppuccin.palettes").get_palette()
local ctp_feline = require('catppuccin.groups.integrations.feline')
local U = require "catppuccin.utils.colors"

ctp_feline.setup({
    assets = {
        left_separator = "",
        right_separator = "",
        mode_icon = "",
        dir = "󰉖",
        file = "󰈙",
        lsp = {
            server = "󰅡",
            error = "",
            warning = "",
            info = "",
            hint = "",
        },
        git = {
            branch = "",
            added = "",
            changed = "",
            removed = "",
        },
    },
    sett = {
        text = U.vary_color({ latte = latte.base }, clrs.surface0),
        bkg = U.vary_color({ latte = latte.crust }, clrs.surface0),
        diffs = clrs.mauve,
        extras = clrs.overlay1,
        curr_file = clrs.maroon,
        curr_dir = clrs.flamingo,
        show_modified = true -- show if the file has been modified
    },
    mode_colors = {
        ["n"] = { "NORMAL", clrs.lavender },
        ["no"] = { "N-PENDING", clrs.lavender },
        ["i"] = { "INSERT", clrs.green },
        ["ic"] = { "INSERT", clrs.green },
        ["t"] = { "TERMINAL", clrs.green },
        ["v"] = { "VISUAL", clrs.flamingo },
        ["V"] = { "V-LINE", clrs.flamingo },
        [""] = { "V-BLOCK", clrs.flamingo },
        ["R"] = { "REPLACE", clrs.maroon },
        ["Rv"] = { "V-REPLACE", clrs.maroon },
        ["s"] = { "SELECT", clrs.maroon },
        ["S"] = { "S-LINE", clrs.maroon },
        [""] = { "S-BLOCK", clrs.maroon },
        ["c"] = { "COMMAND", clrs.peach },
        ["cv"] = { "COMMAND", clrs.peach },
        ["ce"] = { "COMMAND", clrs.peach },
        ["r"] = { "PROMPT", clrs.teal },
        ["rm"] = { "MORE", clrs.teal },
        ["r?"] = { "CONFIRM", clrs.mauve },
        ["!"] = { "SHELL", clrs.green },
    },
    view = {
        lsp = {
            progress = true, -- if true the status bar will display an lsp progress indicator
            name = false, -- if true the status bar will display the lsp servers name, otherwise it will display the text "Lsp"
            exclude_lsp_names = {}, -- lsp server names that should not be displayed when name is set to true
            separator = "|", -- the separator used when there are multiple lsp servers
        },
    }
})

[!Warning] Currently feline doesn't officially support custom themes. In order for :colorscheme catppuccin-<flavour> to work you could add this autocmd as a workaround:

vim.api.nvim_create_autocmd("ColorScheme", {
    pattern = "*",
    callback = function()
        package.loaded["feline"] = nil
        package.loaded["catppuccin.groups.integrations.feline"] = nil
        require("feline").setup {
            components = require("catppuccin.groups.integrations.feline").get(),
        }
    end,
})
fern = false
fidget = false
require("fidget").setup {
    notification = {
        window = {
            winblend = 0,
        },
    }
    -- ... the rest of your fidget config
}
flash = true
gitsigns = true
harpoon = false
headlines = false
hop = false
indent_blankline = {
    enabled = true,
    scope_color = "", -- catppuccin color (eg. `lavender`) Default: text
    colored_indent_levels = false,
},

colored_indent_levels enables char highlights per indent level. Follow the instructions here to set the latter up.

leap = false
let g:lightline = {'colorscheme': 'catppuccin'}
lightspeed = false
lsp_saga = false

For custom Lsp Kind Icon and Color

require("lspsaga").setup {
    ui = {
        kind = require("catppuccin.groups.integrations.lsp_saga").custom_kind(),
    },
}
require('lualine').setup {
    options = {
        theme = "catppuccin"
        -- ... the rest of your lualine config
    }
}
markdown = true
mason = false
mini = {
    enabled = true,
    indentscope_color = "", -- catppuccin color (eg. `lavender`) Default: text
},
neotree = false
neogit = true
neotest = false
noice = false
NormalNvim = false
notifier = false
cmp = true
dap = true
local sign = vim.fn.sign_define

sign("DapBreakpoint", { text = "●", texthl = "DapBreakpoint", linehl = "", numhl = ""})
sign("DapBreakpointCondition", { text = "●", texthl = "DapBreakpointCondition", linehl = "", numhl = ""})
sign("DapLogPoint", { text = "◆", texthl = "DapLogPoint", linehl = "", numhl = ""})
dap_ui = true
native_lsp = {
    enabled = true,
    virtual_text = {
        errors = { "italic" },
        hints = { "italic" },
        warnings = { "italic" },
        information = { "italic" },
    },
    underlines = {
        errors = { "underline" },
        hints = { "underline" },
        warnings = { "underline" },
        information = { "underline" },
    },
    inlay_hints = {
        background = true,
    },
},

In the inners tables you can set the style for the diagnostics, both virtual_text (what you see on the side) and underlines (what points directly at the thing (e.g. an error)).

navic = {
    enabled = false,
    custom_bg = "NONE", -- "lualine" will set background to mantle
},
-- You NEED to enable highlight in nvim-navic setting or it won't work
require("nvim-navic").setup {
    highlight = true
}
notify = false
semantic_tokens = true
nvimtree = true
treesitter_context = true
treesitter = true
ts_rainbow2 = false
ts_rainbow = false
ufo = true
window_picker = false
octo = false
overseer = false
pounce = false
rainbow_delimiters = true

There're 2 available presets (cursor and cursorline) for every flavour.

Here is how you can use them.

require('reactive').setup {
  load = { 'catppuccin-mocha-cursor', 'catppuccin-mocha-cursorline' }
}

To use another flavour just replace mocha with the one you want to use.

[!NOTE] This plugin has been archived by the author, consider using outline.nvim

symbols_outline = false
telekasten = false
telescope = {
    enabled = true,
    -- style = "nvchad"
}
lsp_trouble = false
let g:airline_theme = 'catppuccin'

Use this to set it up:

let g:clap_theme = 'catppuccin'
gitgutter = false
illuminate = {
    enabled = true,
    lsp = false
}
sandwich = false
vim_sneak = false
vimwiki = false
which_key = false

Compile

Important As of 7/10/2022, catppuccin should be able to automatically recompile when the setup table changed.

Catppuccin is a highly customizable and configurable colorscheme. This does however come at the cost of complexity and execution time. Catppuccin can pre compute the results of your configuration and store the results in a compiled lua file. We use these precached values to set it's highlights.

By default catppuccin writes the compiled results into the system's cache directory. You can change the cache dir using:

require("catppuccin").setup({ -- Note: On windows we replace `/` with `\` by default
    compile_path = vim.fn.stdpath "cache" .. "/catppuccin"
})

FAQ

Wrong treesitter highlights

Please disable additional_vim_regex_highlighting

require("nvim-treesitter.configs").setup {
    highlight = {
        enable = true,
        additional_vim_regex_highlighting = false
    },
}

Colors doesn't match preview screenshots

Catppuccin requires true color support AKA terminals support the full range of 16 million colors

  • Supported: iterm2 (macOS), kitty, wezterm, alacritty, tmux, ...

Full list of support terminals can be found here: https://github.com/termstandard/colors#truecolor-support-in-output-devices

  • Unsupported terminal: Terminal.app (macOS), Terminus, Terminology, ...

Full list of Unsupported terminals can be found here: https://github.com/termstandard/colors#not-supporting-truecolor

For tmux users

image

image

Thanks to