feat: added color_overrides to settings

the `g:catppuccin_override_colors` variable was removed in favour of a
setting in the user's Catppuccin conf. This commit also added the
ability to change individual colors per palette and also apply changes
to all of them.
dev
Pocco81 2 years ago
parent f47c6ea226
commit 62856bd8d5

@ -71,6 +71,7 @@ config.options = {
telekasten = true,
symbols_outline = true,
},
color_overrides = {}
}
function config.set_options(opts)

@ -1,5 +1,7 @@
local M = {}
local cnf = require("catppuccin.config").options
function M.get_palette()
local flvr = vim.g.catppuccin_flavour
@ -8,16 +10,20 @@ function M.get_palette()
palette = require("catppuccin.core.palettes." .. flvr)
end
if type(vim.g.catppuccin_override_colors) == "table" then
for k, v in pairs(vim.g.catppuccin_override_colors) do
if palette[k] then
palette[k] = v
else
vim.api.nvim_echo(
{ { 'Warning: "' .. k .. '" is not a valid catppucin palette color.', "WarningMsg" } },
true,
{}
)
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

Loading…
Cancel
Save