fix color transparancy issues

This commit is contained in:
2026-08-28 10:02:40 +02:00
parent 2646541406
commit 50ef290642
2 changed files with 24 additions and 9 deletions
+4 -1
View File
@@ -274,9 +274,12 @@ require('custom.colorizer')
require('custom.keymaps')
require('custom.harpoon')
require('custom.mason')
require('custom.bufferline')
require('custom.kulala')
require('custom.rainbow')
require('custom.none-ls')
require('custom.gitsigns')
require('custom.colortheme')
-- bufferline derives its colors from the Normal highlight group at setup()
-- time, so it must load after the colorscheme is applied above, or it
-- captures the pre-colorscheme (solid) background instead of the final one.
require('custom.bufferline')
+20 -8
View File
@@ -1,9 +1,3 @@
vim.api.nvim_create_autocmd("ColorScheme", {
callback = function()
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "NONE", fg = "#cdd6f5" })
vim.api.nvim_set_hl(0, "FloatBorder", { bg = "NONE", fg = "#3e4452" })
end
})
-- Detect dark or light theme saved in .colorscheme. defaults to dark
local background_mode
local f = io.open(os.getenv('HOME') .. '/.colorscheme', 'r')
@@ -15,6 +9,26 @@ else
background_mode = 'dark'
end
-- Applying these via the ColorScheme autocmd (rather than one-off `:highlight`
-- calls after the colorscheme is set) means every plugin that listens for
-- ColorScheme to pick up transparency - not just whatever runs immediately
-- after this file - sees the final, transparent highlights too.
vim.api.nvim_create_autocmd("ColorScheme", {
callback = function()
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "NONE", fg = "#cdd6f5" })
vim.api.nvim_set_hl(0, "FloatBorder", { bg = "NONE", fg = "#3e4452" })
if background_mode ~= 'dark' then
vim.api.nvim_set_hl(0, "Normal", { bg = "NONE" })
vim.api.nvim_set_hl(0, "StatusLine", { bg = "NONE" })
vim.api.nvim_set_hl(0, "LineNr", { bg = "NONE" })
vim.api.nvim_set_hl(0, "CursorLineNr", { bg = "NONE" })
vim.api.nvim_set_hl(0, "TabLine", { bg = "NONE" })
vim.api.nvim_set_hl(0, "Visual", { bg = "NONE" })
vim.api.nvim_set_hl(0, "NormalNC", { bg = "NONE" })
end
end
})
-- use ayu theme for dark mode, selenized for light mode
if background_mode == 'dark' then
vim.g.ayucolor = background_mode
@@ -23,6 +37,4 @@ if background_mode == 'dark' then
else
vim.cmd("colorscheme zenbones")
vim.cmd("set background=" .. background_mode)
vim.cmd(
'highlight Normal ctermbg=NONE guibg=NONE | highlight StatusLine ctermbg=NONE guibg=NONE | highlight LineNr ctermbg=NONE guibg=NONE | highlight CursorLineNr ctermbg=NONE guibg=NONE | highlight TabLine ctermbg=NONE guibg=NONE | highlight Visual ctermbg=NONE guibg=NONE | highlight NormalNC ctermbg=NONE guibg=NONE')
end