Merge pull request #165 from 3rd/main

feat: support for color overrides
dev
Pocco81 2 years ago committed by GitHub
commit 44496d660e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -317,6 +317,18 @@ local colors = require'catppuccin.api.colors'.get_colors() -- fetch colors with
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
Use them to execute code at certain events. These are the ones available:

@ -71,6 +71,7 @@ config.options = {
telekasten = true,
symbols_outline = true,
},
color_overrides = {}
custom_highlights = {},
}

@ -1,12 +1,34 @@
local M = {}
local cnf = require("catppuccin.config").options
function M.get_palette()
local flvr = vim.g.catppuccin_flavour
local palette = require("catppuccin.core.palettes.mocha")
if flvr == "mocha" or flvr == "latte" or flvr == "macchiato" or flvr == "frappe" then
return require("catppuccin.core.palettes." .. flvr)
palette = require("catppuccin.core.palettes." .. flvr)
end
if type(cnf.color_overrides) == "table" then
for _, pal in pairs({"all", flvr}) do
if cnf.color_overrides[pal] ~= nil then
for k, v in pairs(cnf.color_overrides[pal]) do
if palette[k] then
palette[k] = v
else
vim.api.nvim_echo(
{ { 'Warning: "' .. k .. '" is not a valid catppucin palette color.', "WarningMsg" } },
true,
{}
)
end
end
end
end
end
return require("catppuccin.core.palettes.mocha")
return palette
end
return M

Loading…
Cancel
Save