-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Override Colors on Per Theme Basis #70
Comments
This is possible without an update to the plugin (though it should probably support this use case anyway). You can take advantage of the config = function()
local onedark = require("onedark")
local default_style = "dark"
local function get_theme_overrides(style)
local palette = require("onedark.palette")[style]
if type(palette) == "nil" then
vim.notify(string.format("couldn't get palette for style %q", style), vim.log.levels.ERROR)
return
end
return {
highlights = {
-- ....
},
}
end
local augroup_id = vim.api.nvim_create_augroup("OnedarkStyle", {})
vim.api.nvim_clear_autocmds({ group = augroup_id })
vim.api.nvim_create_autocmd("ColorSchemePre", {
group = augroup_id,
desc = "Apply theme overrides before colorscheme change",
callback = function()
if vim.g.onedark_config and vim.g.onedark_config.loaded then
local overrides = get_theme_overrides(vim.g.onedark_config.style)
onedark.set_options("highlights", overrides.highlights)
-- onedark.set_options("colors", overrides.colors)
-- etc
end
end,
})
onedark.setup({
toggle_style_list = { "dark", "light" },
highlights = get_theme_overrides(default_style).highlights,
})
onedark.load()
end |
Also like this. It would be easier to set up if onedark has builtin support for per-theme overrides. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this plug. It works really well. Is there a way to override colors on a per-theme basis?
Example: I'd like to override
bg1
but only on the dark theme and leave the light theme as default.This obviously doesn't work because setup configs are only evaluated upon initialization. But some way to do this would be nice.
Thanks!
The text was updated successfully, but these errors were encountered: