Replies: 1 comment
-
|
I've got this working with a Snacks.toggle: Snacks.toggle.new({
id = "transparent_bg",
name = "Transparent Background",
get = function()
return require("tokyonight.config").options.transparent
end,
set = function(state)
local theme_opts = require("tokyonight.config").options
theme_opts.transparent = state
require("tokyonight").setup(theme_opts)
vim.cmd([[colorscheme tokyonight]])
end,
}):map("<leader>ux")I'm not sure if there's a better way to update the options than calling setup again, but that's the only thing I could get to work. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
How can I set a keymap to toggle transparency for tokyonight theme.
For catppuccin, I used this:
{ "LazyVim/LazyVim", opts = { colorscheme = "catppuccin" }, keys = { vim.keymap.set("n", "<leader>ux", function() local cat = require("catppuccin") cat.options.transparent_background = not cat.options.transparent_background cat.compile() vim.cmd.colorscheme(vim.g.colors_name) end, { desc = "Toggle Transparent Background" }), }, },How can I achieve the same for tokyonight?
Beta Was this translation helpful? Give feedback.
All reactions