This repository has been archived on 2026-10-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
omarchy-pkgs/pkgbuilds/edge/omarchy-nvim/plugin/after/transparency.lua
T
Jorge Manrubia 59bc0e3cab Fix nvim transparency to preserve foreground colors
nvim_set_hl with just { bg = "none" } replaces the entire highlight
definition, wiping foreground and other attributes. This breaks
snacks.nvim GitHub integration (gh_pr/gh_issue pickers) which reads
fg from Normal/NormalFloat at require-time.

Use nvim_get_hl to fetch existing attributes first, remove only bg,
then set the highlight back.

See basecamp/omarchy#4844 for the companion migration for existing installs.
2026-03-01 19:44:08 +01:00

60 lines
1.1 KiB
Lua

-- Make highlight groups transparent while preserving their other attributes
local function make_transparent(name)
local ok, hl = pcall(vim.api.nvim_get_hl, 0, { name = name, link = false })
if ok then
hl.bg = nil
vim.api.nvim_set_hl(0, name, hl)
end
end
local groups = {
-- transparent background
"Normal",
"NormalFloat",
"FloatBorder",
"Pmenu",
"Terminal",
"EndOfBuffer",
"FoldColumn",
"Folded",
"SignColumn",
"LineNr",
"CursorLineNr",
"NormalNC",
"WhichKeyFloat",
"TelescopeBorder",
"TelescopeNormal",
"TelescopePromptBorder",
"TelescopePromptTitle",
-- neotree
"NeoTreeNormal",
"NeoTreeNormalNC",
"NeoTreeVertSplit",
"NeoTreeWinSeparator",
"NeoTreeEndOfBuffer",
-- nvim-tree
"NvimTreeNormal",
"NvimTreeVertSplit",
"NvimTreeEndOfBuffer",
-- notify
"NotifyINFOBody",
"NotifyERRORBody",
"NotifyWARNBody",
"NotifyTRACEBody",
"NotifyDEBUGBody",
"NotifyINFOTitle",
"NotifyERRORTitle",
"NotifyWARNTitle",
"NotifyTRACETitle",
"NotifyDEBUGTitle",
"NotifyINFOBorder",
"NotifyERRORBorder",
"NotifyWARNBorder",
"NotifyTRACEBorder",
"NotifyDEBUGBorder",
}
for _, name in ipairs(groups) do
make_transparent(name)
end