feat: palette overrides

This commit is contained in:
jostaub 2024-08-02 16:15:45 +02:00
commit 0a1cc638eb
3 changed files with 35 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,28 @@ local variants = {
},
}
if options.palette ~= nil and next(options.palette) then
-- handle override of all variants if defined in config
if options.palette["all"] then
for variant_name in pairs(variants) do
variants[variant_name] = vim.tbl_extend("force", variants[variant_name], options.palette["all"])
end
end
-- handle variant specific overrides
for variant_name, override_palette in pairs(options.palette) do
-- ignore pseudo variant all as is was allready handeld
if variant_name == "all" then
goto continue
end
if variants[variant_name] then
variants[variant_name] = vim.tbl_extend("force", variants[variant_name], override_palette or {})
end
::continue::
end
end
if variants[options.variant] ~= nil then
return variants[options.variant]
end

View file

@ -100,6 +100,16 @@ require("rose-pine").setup({
h6 = "foam",
},
pallet = {
-- override (or append) default color palette of specified variants
-- moon = {
-- base = '#18191a',
-- overlay = '#363738',
-- },
--
-- use "all" instead of variant name to override colors in all variants
},
highlight_groups = {
-- Comment = { fg = "foam" },
-- VertSplit = { fg = "muted", bg = "muted" },