add warning for incorrect color keys and update documentation

dev
anon 2 years ago
parent fb2a69c7ff
commit f47c6ea226

@ -317,6 +317,18 @@ local colors = require'catppuccin.api.colors'.get_colors() -- fetch colors with
catppuccin.remap({ Comment = { fg = colors.flamingo }, }) catppuccin.remap({ Comment = { fg = colors.flamingo }, })
``` ```
#### Overwriting colors
Colors can be overwritten using `vim.g.catppucin_override_colors`:
```lua
vim.g.catppuccin_override_colors = {
base = "#ff0000",
mantle = "#242424",
crust = "#474747",
}
```
#### Hooks #### Hooks
Use them to execute code at certain events. These are the ones available: Use them to execute code at certain events. These are the ones available:

@ -12,6 +12,12 @@ function M.get_palette()
for k, v in pairs(vim.g.catppuccin_override_colors) do for k, v in pairs(vim.g.catppuccin_override_colors) do
if palette[k] then if palette[k] then
palette[k] = v palette[k] = v
else
vim.api.nvim_echo(
{ { 'Warning: "' .. k .. '" is not a valid catppucin palette color.', "WarningMsg" } },
true,
{}
)
end end
end end
end end

Loading…
Cancel
Save