twilight.nvim icon indicating copy to clipboard operation
twilight.nvim copied to clipboard

Background is black when using guibg=NONE

Open TheSmallTeaBoi opened this issue 3 years ago • 6 comments

This is how it looks without guibg=NONE: image and here's how it looks with it: image

(I use this option to set vim's bg to my terminal's, in case there's a better way of doing this)

TheSmallTeaBoi avatar Aug 18 '21 20:08 TheSmallTeaBoi

Having the same issue here. Is there a way to ignore background colour and only adjust/dim treesitter syntax highlighting?

axieax avatar Sep 02 '21 03:09 axieax

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

2021-09-03-07-50-15_1920x1080

VOILA!

2021-09-03-08-10-14_1920x1080

Note that this is only a hack(which may result in bugs) and hopefully the maintainer finds a proper way of solving this issue.

matdexir avatar Sep 03 '21 00:09 matdexir

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

BerkinAKKAYA avatar Oct 10 '21 08:10 BerkinAKKAYA

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)?

axieax avatar Jan 02 '22 11:01 axieax

I just started seeing this… I think my colorscheme adjusted the way it calculates background.

evantravers avatar Jun 01 '22 01:06 evantravers