From 3147e047dceffecfdeee82d089d70c4ff3dbc7bd Mon Sep 17 00:00:00 2001 From: nullchilly Date: Sat, 16 Jul 2022 13:23:38 +0700 Subject: [PATCH 01/11] feat(readme): Add FAQ --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index f888b3d..4819539 100644 --- a/README.md +++ b/README.md @@ -452,6 +452,25 @@ vim.api.nvim_create_autocmd("User", { }) ``` +#### FAQ + +**Abnormal colors?** + +You need to enable [truecolor](https://wiki.archlinux.org/title/Color_output_in_console#True_color_support) + +**Toggle based on background value?** + +```lua +-- set background=light will change flavour to latte +-- set background=dark -> mocha flavour +vim.api.nvim_create_autocmd("OptionSet", { + pattern = "background", + callback = function() + vim.cmd("Catppuccin " .. (vim.v.option_new == "light" and "latte" or "mocha")) + end, +}) +``` + ## 💝 Thanks to - [Pocco81](https://github.com/Pocco81) From 92d66b064b042fb051dd9ed1ac876f93803b2b9a Mon Sep 17 00:00:00 2001 From: nullchilly Date: Sat, 16 Jul 2022 13:26:53 +0700 Subject: [PATCH 02/11] feat(readme): Change FAQ priority --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4819539..2441280 100644 --- a/README.md +++ b/README.md @@ -452,7 +452,7 @@ vim.api.nvim_create_autocmd("User", { }) ``` -#### FAQ +## FAQ **Abnormal colors?** From 683e99c013a85e20d733fc0380445a6279d91dd5 Mon Sep 17 00:00:00 2001 From: nullchilly Date: Sat, 16 Jul 2022 13:28:51 +0700 Subject: [PATCH 03/11] feat(readme): Improve toggling FAQ --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2441280..695b8b0 100644 --- a/README.md +++ b/README.md @@ -458,11 +458,15 @@ vim.api.nvim_create_autocmd("User", { You need to enable [truecolor](https://wiki.archlinux.org/title/Color_output_in_console#True_color_support) -**Toggle based on background value?** +**Toggle light/dark theme based on background value?** + +For people who are hybrid between light and dark mode! + +`set background=light` will change flavour to latte + +`set background=dark` -> mocha flavour ```lua --- set background=light will change flavour to latte --- set background=dark -> mocha flavour vim.api.nvim_create_autocmd("OptionSet", { pattern = "background", callback = function() From 690b1c7867a55a17db134d5f2f62f69d6097eee5 Mon Sep 17 00:00:00 2001 From: nullchilly Date: Sat, 16 Jul 2022 13:29:09 +0700 Subject: [PATCH 04/11] feat(readme): Improve toggling FAQ (part 2) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 695b8b0..4d92f96 100644 --- a/README.md +++ b/README.md @@ -464,7 +464,7 @@ For people who are hybrid between light and dark mode! `set background=light` will change flavour to latte -`set background=dark` -> mocha flavour +`set background=dark` to mocha flavour ```lua vim.api.nvim_create_autocmd("OptionSet", { From b28c686ad95dc30da671f59cf1e290c2f9650a3a Mon Sep 17 00:00:00 2001 From: nullchilly Date: Sat, 16 Jul 2022 13:29:55 +0700 Subject: [PATCH 05/11] feat(readme): Change subset --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4d92f96..4899e95 100644 --- a/README.md +++ b/README.md @@ -454,11 +454,11 @@ vim.api.nvim_create_autocmd("User", { ## FAQ -**Abnormal colors?** +#### Abnormal colors? You need to enable [truecolor](https://wiki.archlinux.org/title/Color_output_in_console#True_color_support) -**Toggle light/dark theme based on background value?** +#### Toggle light/dark theme based on background value? For people who are hybrid between light and dark mode! From d60439fe89bc478d1ae09f07e59c4f39343aa3d6 Mon Sep 17 00:00:00 2001 From: nullchilly Date: Sat, 16 Jul 2022 13:31:29 +0700 Subject: [PATCH 06/11] feat(readme): update --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4899e95..e0eaf55 100644 --- a/README.md +++ b/README.md @@ -460,11 +460,7 @@ You need to enable [truecolor](https://wiki.archlinux.org/title/Color_output_in_ #### Toggle light/dark theme based on background value? -For people who are hybrid between light and dark mode! - -`set background=light` will change flavour to latte - -`set background=dark` to mocha flavour +For people who are hybrid between light and dark mode you can use this autocmd! ```lua vim.api.nvim_create_autocmd("OptionSet", { @@ -475,6 +471,8 @@ vim.api.nvim_create_autocmd("OptionSet", { }) ``` +`set background=light` will change flavour to latte and `set background=dark` to mocha flavour + ## 💝 Thanks to - [Pocco81](https://github.com/Pocco81) From 4205698c05e902ad3636d6a65d63cd4cc40f68bb Mon Sep 17 00:00:00 2001 From: nullchilly Date: Sat, 16 Jul 2022 13:42:08 +0700 Subject: [PATCH 07/11] feat(readme): Update remap and color_overrides --- README.md | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index e0eaf55..c82a227 100644 --- a/README.md +++ b/README.md @@ -374,20 +374,12 @@ Acknowledge: [nightfox.nvim#compile](https://github.com/EdenEast/nightfox.nvim#c ### Extra -#### API - -The API allows you fetch data from Catppuccin. It can be required as a Lua module: - -```lua -local cp_api = require("catppuccin.api.") -``` - ##### Modules - `colors` ```lua -cp_api.get_colors() +require("catppuccin.palettes").get_palette() ``` > Returns a table where the key is the name of the color and the value is its hex value. @@ -397,26 +389,36 @@ cp_api.get_colors() Highlight groups can be overwritten like so: ```lua -catppuccin.remap({ = { }, }) +custom_highlights = { + = { } +} ``` Here is an example: ```lua -local colors = require'catppuccin.api.colors'.get_colors() -- fetch colors with API -catppuccin.remap({ Comment = { fg = colors.flamingo }, }) +local colors = require("catppuccin.palettes").get_palette() -- fetch colors from palette +custom_highlights = { + Comment = { fg = colors.flamingo } + TSConstBuiltin = { fg = colors.peach, style = {} }, + TSConstant = { fg = colors.sky }, + TSComment = { fg = colors.surface2, style = { "italic" } } +} ``` #### Overwriting colors -Colors can be overwritten using `vim.g.catppucin_override_colors`: +Colors can be overwritten using `color_overrides`: ```lua -vim.g.catppuccin_override_colors = { - base = "#ff0000", - mantle = "#242424", - crust = "#474747", -} +color_overrides = { + frappe = { + text = "#ffffff" + base = "#ff0000", + mantle = "#242424", + crust = "#474747", + } +}, ``` #### Hooks @@ -454,13 +456,13 @@ vim.api.nvim_create_autocmd("User", { ## FAQ -#### Abnormal colors? +#### [Abnormal colors](https://github.com/catppuccin/nvim/issues/182)? You need to enable [truecolor](https://wiki.archlinux.org/title/Color_output_in_console#True_color_support) #### Toggle light/dark theme based on background value? -For people who are hybrid between light and dark mode you can use this autocmd! +`set background=light` will change flavour to latte and `set background=dark` to mocha flavour ```lua vim.api.nvim_create_autocmd("OptionSet", { @@ -471,7 +473,7 @@ vim.api.nvim_create_autocmd("OptionSet", { }) ``` -`set background=light` will change flavour to latte and `set background=dark` to mocha flavour +For people who are hybrid between light and dark mode you can try out this autocmd! ## 💝 Thanks to From 39853eb8ae51d325d9d40efa264d66276da2ca04 Mon Sep 17 00:00:00 2001 From: nullchilly Date: Sat, 16 Jul 2022 13:43:31 +0700 Subject: [PATCH 08/11] feat(readme): Setting clarification --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c82a227..3d71b8f 100644 --- a/README.md +++ b/README.md @@ -386,7 +386,7 @@ require("catppuccin.palettes").get_palette() #### Overwriting highlight groups -Highlight groups can be overwritten like so: +Highlight groups can be overwritten in the setting like so: ```lua custom_highlights = { @@ -408,7 +408,7 @@ custom_highlights = { #### Overwriting colors -Colors can be overwritten using `color_overrides`: +Colors can be overwritten using `color_overrides` in the setting: ```lua color_overrides = { From 1e8061934ec70d0192a9ffb66dcd62ba399fa7b8 Mon Sep 17 00:00:00 2001 From: nullchilly Date: Sat, 16 Jul 2022 13:53:27 +0700 Subject: [PATCH 09/11] feat(readme): Refactor compile section --- README.md | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 3d71b8f..0cc57a1 100644 --- a/README.md +++ b/README.md @@ -310,7 +310,9 @@ Catppuccin is a highly customizable and configurable colorscheme. This does howe 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. -- Setting `enabled` to `true` enables this feature: +#### Enable + +Setting `enabled` to `true` enables this feature: ```lua compile = { @@ -322,16 +324,17 @@ compile = { By default catppuccin writes the compiled results into the system's cache directory. -- Catppuccin provides these commands to work with the catppuccin compiler. +#### Catppuccin provides these commands to work with the catppuccin compiler. ```bash :CatppuccinCompile # Create/update the compile file :CatppuccinClean # Delete compiled file ``` -- It's recommended to add `:CatppuccinCompile` to post-install/update hooks. For example: +#### Post-install/update hooks +It's recommended to add `:CatppuccinCompile` to post-install/update hooks. For example: -#### Packer.nvim +Packer.nvim ```lua use { @@ -341,19 +344,18 @@ use { } ``` -#### Vim-plug +Vim-plug ```lua Plug 'catppuccin/nvim', {'as': 'catppuccin', 'do': 'CatppuccinCompile'} ``` -- To auto-compile everytime you update your config: - -#### Packer.nvim +#### Auto compile -Create an autocmd `User PackerCompileDone` to update it every time packer is compiled: +Packer.nvim ```lua +-- Create an autocmd `User PackerCompileDone` to update it every time packer is compiled: vim.api.nvim_create_autocmd("User", { pattern = "PackerCompileDone", callback = function() @@ -362,11 +364,10 @@ vim.api.nvim_create_autocmd("User", { }) ``` -#### Vim-plug - -Auto compile on save if catppuccin config is in `init.vim` +Vim-plug -```lua +```bash +# Auto compile on save if catppuccin config is in `init.vim` autocmd BufWritePost init.vim :CatppuccinCompile ``` @@ -462,7 +463,7 @@ You need to enable [truecolor](https://wiki.archlinux.org/title/Color_output_in_ #### Toggle light/dark theme based on background value? -`set background=light` will change flavour to latte and `set background=dark` to mocha flavour +The following autocmd will change the flavour to latte when you `:set background=light` and to mocha after `:set background=dark` ```lua vim.api.nvim_create_autocmd("OptionSet", { @@ -473,7 +474,7 @@ vim.api.nvim_create_autocmd("OptionSet", { }) ``` -For people who are hybrid between light and dark mode you can try out this autocmd! +For people who are hybrid between light and dark mode! ## 💝 Thanks to From 9cedb51554976d7beafe0a75dc9529e7f3f2aa59 Mon Sep 17 00:00:00 2001 From: nullchilly Date: Sat, 16 Jul 2022 14:02:01 +0700 Subject: [PATCH 10/11] feat(readme): done --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f70815f..809ec1a 100644 --- a/README.md +++ b/README.md @@ -324,7 +324,7 @@ compile = { By default catppuccin writes the compiled results into the system's cache directory. -#### Catppuccin provides these commands to work with the catppuccin compiler. +#### Compile commands ```bash :CatppuccinCompile # Create/update the compile file From e350e3d6f0a487a56571caf2eeaac0f915520296 Mon Sep 17 00:00:00 2001 From: nullchilly Date: Sat, 16 Jul 2022 14:02:54 +0700 Subject: [PATCH 11/11] feat(readme): Clean up origin files --- README.md.orig | 505 ------------------------------------------------- 1 file changed, 505 deletions(-) delete mode 100644 README.md.orig diff --git a/README.md.orig b/README.md.orig deleted file mode 100644 index 7fc2fc7..0000000 --- a/README.md.orig +++ /dev/null @@ -1,505 +0,0 @@ -

- Logo
- - Catppuccin for NeoVim - -

- -

- - - -

- -

- -

- -# About - -This port of Catppuccin is special because it was the first one and the one that originated the project itself. Given this, it's important to acknowledge that it all didn't come to be what it is now out of nowhere. So, if you are interested in knowing more about the initial stages of the theme, you can find it under the [`old-catppuccino`](https://github.com/catppuccin/nvim/tree/old-catppuccino) branch. - -# 🎁 Features - -- Handy CLI. -- Extensible for many use cases. -- [Compile](https://github.com/catppuccin/nvim#Compile) user's configuration -- Integrations with a bunch of plugins: - - [Treesitter](https://github.com/tree-sitter/tree-sitter) - - [Native LSP](https://github.com/neovim/nvim-lspconfig) - - [Telescope](https://github.com/nvim-telescope/telescope.nvim) - - [Feline](https://github.com/feline-nvim/feline.nvim) - - [Lualine](https://github.com/hoob3rt/lualine.nvim) - - [Nvim-cmp](https://github.com/hrsh7th/nvim-cmp) - - [LSP Saga](https://github.com/tami5/lspsaga.nvim) - - [Git signs](https://github.com/lewis6991/gitsigns.nvim) - - [Indent Blankline](https://github.com/lukas-reineke/indent-blankline.nvim) - - [Trouble](https://github.com/folke/trouble.nvim) - - [WhichKey](https://github.com/folke/which-key.nvim) - - [BarBar](https://github.com/romgrk/barbar.nvim) - - [NvimTree](https://github.com/kyazdani42/nvim-tree.lua) - - [Neo-tree](https://github.com/nvim-neo-tree/neo-tree.nvim) - - [Git Gutter](https://github.com/airblade/vim-gitgutter) - - [Fern](https://github.com/lambdalisue/fern.vim) - - [Lightline](https://github.com/itchyny/lightline.vim) - - [Dashboard](https://github.com/glepnir/dashboard-nvim) - - [Markdown](https://www.markdownguide.org/) - - [Lightspeed](https://github.com/ggandor/lightspeed.nvim) - - [Nvim-ts-Rainbow](https://github.com/p00f/nvim-ts-rainbow) - - [Sneak](https://github.com/justinmk/vim-sneak) - - [Hop](https://github.com/phaazon/hop.nvim) - - [Neogit](https://github.com/TimUntersberger/neogit) - - [Telekasten](https://github.com/renerocksai/telekasten.nvim) - - [Notify](https://github.com/rcarriga/nvim-notify) - - [Symbols-Outline](https://github.com/simrat39/symbols-outline.nvim) - - [Mini.nvim](https://github.com/echasnovski/mini.nvim) - -## Usage - -You can use your favorite plugin manager for this. Here are some examples with the most popular ones: - -#### Vim-plug - -```lua -Plug 'catppuccin/nvim', {'as': 'catppuccin'} -``` - -#### Packer.nvim - -```lua -use({ - "catppuccin/nvim", - as = "catppuccin" -}) -``` - -#### Vundle - -```lua -Plugin 'catppuccin/nvim', {'name': 'catppuccin'} -``` - -### Setup - -There are already some sane defaults that you may like, however you can change them to match your taste. These are the defaults: - -```lua -dim_inactive = { - enabled = false - shade = "dark", - percentage = 0.15, -}, -transparent_background = false, -term_colors = false, -compile = { - enabled = false, - path = vim.fn.stdpath "cache" .. "/catppuccin", - suffix = "_compiled" -}, -styles = { - comments = { "italic" }, - conditionals = { "italic" }, - loops = {}, - functions = {}, - keywords = {}, - strings = {}, - variables = {}, - numbers = {}, - booleans = {}, - properties = {}, - types = {}, - operators = {}, -}, -integrations = { - treesitter = true, - native_lsp = { - enabled = true, - virtual_text = { - errors = { "italic" }, - hints = { "italic" }, - warnings = { "italic" }, - information = { "italic" }, - }, - underlines = { - errors = { "underline" }, - hints = { "underline" }, - warnings = { "underline" }, - information = { "underline" }, - }, - }, - coc_nvim = false, - lsp_trouble = false, - cmp = true, - lsp_saga = false, - gitgutter = false, - gitsigns = true, - telescope = true, - nvimtree = { - enabled = true, - show_root = true, - transparent_panel = false, - }, - neotree = { - enabled = false, - show_root = true, - transparent_panel = false, - }, - which_key = false, - indent_blankline = { - enabled = true, - colored_indent_levels = false, - }, - dashboard = true, - neogit = false, - vim_sneak = false, - fern = false, - barbar = false, - bufferline = true, - markdown = true, - lightspeed = false, - ts_rainbow = false, - hop = false, - notify = true, - telekasten = true, - symbols_outline = true, - mini = false, -} -``` - -The way you setup the settings on your configuration varies based on whether you are using vimL for this or Lua. - -
- For init.lua -

- -```lua -local catppuccin = require("catppuccin") - --- configure it -catppuccin.setup() -``` - -
-

- -
- For init.vim -

- -```lua -lua << EOF -local catppuccin = require("catppuccin") - --- configure it -catppuccin.setup() -EOF -``` - -
-

- -After setting things up, you can load catppuccin like so: - -```vim -" Vim Script -let g:catppuccin_flavour = "frappe" " latte, frappe, macchiato, mocha -colorscheme catppuccin -``` - -```lua --- Lua -vim.g.catppuccin_flavour = "frappe" -- latte, frappe, macchiato, mocha -vim.cmd[[colorscheme catppuccin]] -``` - -Remember that if you want to switch your Catppuccin flavour "on the fly" you may use the `:Catppuccin ` command. - -> Note: the command has autocompletion enabled, so you can just press tab to cycle through the flavours - -### Configuration - -Although settings already have self-explanatory names, here is where you can find info about each one of them and their classifications! - -#### General - -This settings are unrelated to any group and are independent. - -- `transparent_background`: (Boolean) if true, disables setting the background color. -- `term_colors`: (Boolean) if true, sets terminal colors (e.g. `g:terminal_color_0`). - -#### Dim inactive - -This setting manages the ability to dim the inactive splits/windows/buffers displayed. - -- `enabled`: (Boolean) if true, dims the background color of inactive window or buffer or split. -- `shade`: (string) sets the shade to apply to the inactive split or window or buffer. -- `percentage`: (number 0 < x < 1) percentage of the shade to apply to the inactive window, split or buffer. - -#### Styles - -Handles the style of general hi groups (see `:h highlight-args`): - -- `comments`: (String) changed the style of the comments. -- `functions`: (String) changed the style of the functions. -- `keywords`: (String) changed the style of the keywords. -- `strings`: (String) changed the style of the strings. -- `variables`: (String) changed the style of the variables. - -#### Integrations - -These integrations allow catppuccin to set the theme of various plugins/stuff. To enable an integration you just need to set it to `true`, however, there are some special integrations... - -If you'd like to know which highlight groups are being affected by catppuccin, checkout this directory: [`lua/catppuccin/core/integrations/`](https://github.com/catppuccin/nvim/tree/main/lua/catppuccin/core/integrations). - -##### Special Integrations - -- **Feline.nvim**: First make sure that the [kyazdani42/nvim-web-devicons](https://github.com/kyazdani42/nvim-web-devicons/) plugin is installed. Then update your Feline config to use the Catppuccin components: - -```lua -require("feline").setup({ - components = require('catppuccin.core.integrations.feline'), -}) -``` - -- **Indent-blankline.nvim**: setting `enabled` to `true` enables this integration. `colored_indent_levels` enables char highlights per indent level. Follow the instructions [here](https://github.com/lukas-reineke/indent-blankline.nvim#with-custom-gindent_blankline_char_highlight_list) to set the latter up. -- **Lightline:** use this to set it up (Note: `catppuccin` is the only valid colorscheme name. It will pick the one set in your config): - -```lua -let g:lightline = {'colorscheme': 'catppuccin'} -``` - -- **Lualine:** use this to set it up (Note: `catppuccin` is the only valid theme name. It will pick the one set in your config): - -```lua -require('lualine').setup { - options = { - theme = "catppuccin" - -- ... the rest of your lualine config - } -} -``` - -- **Native Nvim LSP:** setting `enabled` to `true` enables this integration. 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)). -- **NvimTree:** setting `enabled` to `true` enables this integration: - -```lua -integration = { - nvimtree = { - enabled = true, - show_root = true, -- makes the root folder not transparent - transparent_panel = false, -- make the panel transparent - } -} -``` - -- **Neo-tree:** setting `enabled` to `true` enables this integration: - -```lua -integration = { - neotree = { - enabled = true, - show_root = true, -- makes the root folder not transparent - transparent_panel = false, -- make the panel transparent - } -} -``` - -### Compile - -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. - -#### Enable - -Setting `enabled` to `true` enables this feature: - -```lua -compile = { - enabled = true, - path = vim.fn.stdpath "cache" .. "/catppuccin", - suffix = "_compiled" -}, -``` - -By default catppuccin writes the compiled results into the system's cache directory. - -#### Catppuccin provides these commands to work with the catppuccin compiler. - -```bash -:CatppuccinCompile # Create/update the compile file -:CatppuccinClean # Delete compiled file -``` - -<<<<<<< HEAD -#### Post-install/update hooks -It's recommended to add `:CatppuccinCompile` to post-install/update hooks. For example: - -Packer.nvim -======= -- To auto-compile everytime you update your config: - -**Packer.nvim** ->>>>>>> origin/dev - -```lua --- It's recommended to add `:CatppuccinCompile` to post-install/update hooks -use { - "catppuccin/nvim", - as = "catppuccin", - run = "CatppuccinCompile", -} - -<<<<<<< HEAD -Vim-plug - -```lua -Plug 'catppuccin/nvim', {'as': 'catppuccin', 'do': 'CatppuccinCompile'} -``` - -#### Auto compile - -Packer.nvim - -```lua -======= ->>>>>>> origin/dev --- Create an autocmd `User PackerCompileDone` to update it every time packer is compiled: -vim.api.nvim_create_autocmd("User", { - pattern = "PackerCompileDone", - callback = function() - vim.cmd "CatppuccinCompile" - end, -}) -``` - -<<<<<<< HEAD -Vim-plug - -```bash -# Auto compile on save if catppuccin config is in `init.vim` -======= -**Vim-plug** - -```bash -# It's recommended to add `:CatppuccinCompile` to post-install/update hooks -Plug 'catppuccin/nvim', {'as': 'catppuccin', 'do': 'CatppuccinCompile'} -# Auto compile on save if catppuccin config is in init.vim ->>>>>>> origin/dev -autocmd BufWritePost init.vim :CatppuccinCompile -``` - -Acknowledge: [nightfox.nvim#compile](https://github.com/EdenEast/nightfox.nvim#compile) - -### Extra - -##### Modules - -- `colors` - -```lua -require("catppuccin.palettes").get_palette() -``` - -> Returns a table where the key is the name of the color and the value is its hex value. - -#### Overwriting highlight groups - -Highlight groups can be overwritten in the setting like so: - -```lua -custom_highlights = { - = { } -} -``` - -Here is an example: - -```lua -local colors = require("catppuccin.palettes").get_palette() -- fetch colors from palette -custom_highlights = { - Comment = { fg = colors.flamingo } - TSConstBuiltin = { fg = colors.peach, style = {} }, - TSConstant = { fg = colors.sky }, - TSComment = { fg = colors.surface2, style = { "italic" } } -} -``` - -#### Overwriting colors - -Colors can be overwritten using `color_overrides` in the setting: - -```lua -color_overrides = { - frappe = { - text = "#ffffff" - base = "#ff0000", - mantle = "#242424", - crust = "#474747", - } -}, -``` - -#### Hooks - -Use them to execute code at certain events. These are the ones available: - -| Function | Description | -| ------------------ | ---------------------------- | -| `before_loading()` | Before loading a colorscheme | -| `after_loading()` | After loading a colorscheme | - -They can be used like so: - -```lua -local catppuccin = require("catppuccin") - -catppuccin.before_loading = function () - print("I ran before loading Catppuccin!") -end -``` - -#### Autocmd - -Instead of `after_loading` hook, you can use autocmd event like this: - -```lua -vim.api.nvim_create_autocmd("User", { - pattern = "CatppuccinLoaded", - callback = function() - local colors = require("catppuccin.api.colors").get_colors() - -- do something with colors - end -}) -``` - -## FAQ - -#### [Abnormal colors](https://github.com/catppuccin/nvim/issues/182)? - -You need to enable [truecolor](https://wiki.archlinux.org/title/Color_output_in_console#True_color_support) - -#### Toggle light/dark theme based on background value? - -The following autocmd will change the flavour to latte when you `:set background=light` and to mocha after `:set background=dark` - -```lua -vim.api.nvim_create_autocmd("OptionSet", { - pattern = "background", - callback = function() - vim.cmd("Catppuccin " .. (vim.v.option_new == "light" and "latte" or "mocha")) - end, -}) -``` - -For people who are hybrid between light and dark mode! - -## 💝 Thanks to - -- [Pocco81](https://github.com/Pocco81) - -  - -

-

Copyright © 2021-present Catppuccin Org -