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, telekasten = true,
symbols_outline = true, symbols_outline = true,
}, },
color_overrides = {}
} }
function config.set_options(opts) function config.set_options(opts)

@ -1,5 +1,7 @@
local M = {} local M = {}
local cnf = require("catppuccin.config").options
function M.get_palette() function M.get_palette()
local flvr = vim.g.catppuccin_flavour local flvr = vim.g.catppuccin_flavour
@ -8,8 +10,10 @@ function M.get_palette()
palette = require("catppuccin.core.palettes." .. flvr) palette = require("catppuccin.core.palettes." .. flvr)
end end
if type(vim.g.catppuccin_override_colors) == "table" then if type(cnf.color_overrides) == "table" then
for k, v in pairs(vim.g.catppuccin_override_colors) do 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 if palette[k] then
palette[k] = v palette[k] = v
else else
@ -21,6 +25,8 @@ function M.get_palette()
end end
end end
end end
end
end
return palette return palette
end end

Loading…
Cancel
Save