fix color transparancy issues
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user