mirror of
https://github.com/rose-pine/neovim.git
synced 2025-10-15 12:38:53 +02:00
feat: palette overrides
This commit is contained in:
parent
e4b08d74b7
commit
0a1cc638eb
3 changed files with 35 additions and 0 deletions
|
|
@ -35,6 +35,9 @@ config.options = {
|
|||
transparency = false,
|
||||
},
|
||||
|
||||
---@type table<string, table<string, string>>
|
||||
palette = {},
|
||||
|
||||
---@type table<string, string | PaletteColor>
|
||||
groups = {
|
||||
border = "muted",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue