feat(readme): Update remap and color_overrides

dev
nullchilly 2 years ago
parent d60439fe89
commit 4205698c05

@ -374,20 +374,12 @@ Acknowledge: [nightfox.nvim#compile](https://github.com/EdenEast/nightfox.nvim#c
### Extra ### 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.<module>")
```
##### Modules ##### Modules
- `colors` - `colors`
```lua ```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. > 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: Highlight groups can be overwritten like so:
```lua ```lua
catppuccin.remap({ <hi_group> = { <fields> }, }) custom_highlights = {
<hi_group> = { <fields> }
}
``` ```
Here is an example: Here is an example:
```lua ```lua
local colors = require'catppuccin.api.colors'.get_colors() -- fetch colors with API local colors = require("catppuccin.palettes").get_palette() -- fetch colors from palette
catppuccin.remap({ Comment = { fg = colors.flamingo }, }) custom_highlights = {
Comment = { fg = colors.flamingo }
TSConstBuiltin = { fg = colors.peach, style = {} },
TSConstant = { fg = colors.sky },
TSComment = { fg = colors.surface2, style = { "italic" } }
}
``` ```
#### Overwriting colors #### Overwriting colors
Colors can be overwritten using `vim.g.catppucin_override_colors`: Colors can be overwritten using `color_overrides`:
```lua ```lua
vim.g.catppuccin_override_colors = { color_overrides = {
base = "#ff0000", frappe = {
mantle = "#242424", text = "#ffffff"
crust = "#474747", base = "#ff0000",
} mantle = "#242424",
crust = "#474747",
}
},
``` ```
#### Hooks #### Hooks
@ -454,13 +456,13 @@ vim.api.nvim_create_autocmd("User", {
## FAQ ## 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) 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 you can use this autocmd! `set background=light` will change flavour to latte and `set background=dark` to mocha flavour
```lua ```lua
vim.api.nvim_create_autocmd("OptionSet", { 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 ## 💝 Thanks to

Loading…
Cancel
Save