twilight.nvim
twilight.nvim copied to clipboard
Background is black when using guibg=NONE
This is how it looks without guibg=NONE
:
and here's how it looks with it:
(I use this option to set vim's bg to my terminal's, in case there's a better way of doing this)
Having the same issue here. Is there a way to ignore background colour and only adjust/dim treesitter syntax highlighting?
Hi Guys, I found a little workaround/hack that only requires 4 lines of lua code.
local ok, hl = pcall(vim.api.nvim_get_hl_by_name, "Normal", true)
if hl["background"] == nil then
bg = "NONE"
end
The issue lies with config.lua
where the background defaults to #000000
whenever the highlighting for the background is set to NONE.
So, if you want it to work properly you have to ensure that guibg=NONE
.
If you want to use my hack:
- Find where the twilight source code is on your machine.
- Add the snippet of code I wrote to twilight.nvim/lua/twilight/config.lua
VOILA!
Note that this is only a hack(which may result in bugs) and hopefully the maintainer finds a proper way of solving this issue.
Setting guibg to NONE
at the end of the function M.colors()
fixes it as well.
-- twilight.nvim/lua/twilight/config.lua
function M.colors()
...
vim.cmd("highlight! def Twilight guifg=" .. dimmed .. " guibg=NONE")
end
Hello @folke sorry for the bump, but could we get some updates on this on the repo (potentially a merge request/commit that resolves this)?
I just started seeing this… I think my colorscheme adjusted the way it calculates background.