doc: hooks and overwriting hi groups

experiments
Pocco81 3 years ago
parent 5076662f50
commit 5bfbfa6eae

@ -282,6 +282,8 @@ colorscheme catppuccin
vim.cmd[[colorscheme catppuccin]] vim.cmd[[colorscheme catppuccin]]
``` ```
### Extra
#### API #### API
The API allows you fetch data from Catppuccin. It can be required as a Lua module: The API allows you fetch data from Catppuccin. It can be required as a Lua module:
@ -300,6 +302,40 @@ cp_api.get_colors()
> Returns a table where the key is the name of the color and the value is its hex value. > Returns a table where the key is the name of the color and the value is its hex value.
#### Overwriting highlight groups
Both colors and highlight groups can be overwritten like so:
```lua
catppuccin.remap({ <hi_group> = { <fields> }, })
```
Here is an example:
```lua
local colors = require'catppuccin.api.colors'.get_colors() -- fetch colors with API
catppuccin.remap({ Comment = { fg = colors.catppuccin2 }, })
```
#### 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")
catppuccino.before_loading = function ()
print("I ran before loading Catppuccin!")
end
```
### Configuration ### Configuration
Although settings already have self-explanatory names, here is where you can find info about each one of them and their classifications! Although settings already have self-explanatory names, here is where you can find info about each one of them and their classifications!

Loading…
Cancel
Save