feat: palette overrides (#307)

* feat: palette overrides

* removed option all from palett override

* removed dead code forgotten in last commit

* fix typo in readme and simplified comment

Co-authored-by: not <mvllow@icloud.com>

---------

Co-authored-by: not <mvllow@icloud.com>
This commit is contained in:
jostaub 2024-08-14 20:40:33 +02:00 committed by GitHub
commit 94ffdb7748
3 changed files with 20 additions and 0 deletions

View file

@ -35,6 +35,9 @@ config.options = {
transparency = false,
},
---@type table<string, table<string, string>>
palette = {},
---@type table<string, string | PaletteColor>
groups = {
border = "muted",

View file

@ -62,6 +62,15 @@ local variants = {
},
}
if options.palette ~= nil and next(options.palette) then
-- handle variant specific overrides
for variant_name, override_palette in pairs(options.palette) do
if variants[variant_name] then
variants[variant_name] = vim.tbl_extend("force", variants[variant_name], override_palette or {})
end
end
end
if variants[options.variant] ~= nil then
return variants[options.variant]
end