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 256d086c21
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 0 deletions

View file

@ -35,6 +35,9 @@ config.options = {
transparency = false, transparency = false,
}, },
---@type table<string, table<string, string>>
palette = {},
---@type table<string, string | PaletteColor> ---@type table<string, string | PaletteColor>
groups = { groups = {
border = "muted", 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 if variants[options.variant] ~= nil then
return variants[options.variant] return variants[options.variant]
end end

View file

@ -100,6 +100,14 @@ require("rose-pine").setup({
h6 = "foam", h6 = "foam",
}, },
pallete = {
-- Override the builtin palette per variant
-- moon = {
-- base = '#18191a',
-- overlay = '#363738',
-- },
},
highlight_groups = { highlight_groups = {
-- Comment = { fg = "foam" }, -- Comment = { fg = "foam" },
-- VertSplit = { fg = "muted", bg = "muted" }, -- VertSplit = { fg = "muted", bg = "muted" },