navarasu / onedark.nvim

One dark and light colorscheme for neovim >= 0.5.0 written in lua based on Atom's One Dark and Light theme. Additionally, it comes with 5 color variant styles
MIT License
1.62k stars 164 forks source link

Toggle transparent property #51

Closed rod-stuchi closed 2 years ago

rod-stuchi commented 2 years ago

Hi, first of all, thank you for this amazing theme :beer:

I have a function to toggle transparency.

function M.toggle_transparency()
  vim.g.onedark_transparent_background = not vim.g.onedark_transparent_background
  vim.cmd[[colorscheme onedark]]
end

This global propertyonedark_transparent_background has present in ce49cf36dc839564e95290e2cdace396c148bca.

I tried with require('onedark').set_options('transparent', true) but with no success.

My question is, how can I achieve this behavior in new version?

xeluxee commented 2 years ago

To check option simply see vim.g.onedark_config.transparent

To change option use this:

require('onedark').setup({transparent = false})
require('onedark').load()
rod-stuchi commented 2 years ago

Very nice

function M.toggle_transparency()
  require('onedark').setup({transparent = not vim.g.onedark_config.transparent})
  require('onedark').load()
end

Thank you so much