From 7205d3902adf14c11b6aee658d6dcddd37b7ba95 Mon Sep 17 00:00:00 2001 From: Webhooked Date: Thu, 8 May 2025 09:43:49 +0200 Subject: [PATCH] Fix for transparent background support --- lua/kanso/highlights/editor.lua | 16 ++++++++-------- lua/kanso/highlights/plugins.lua | 20 ++++++++++---------- lua/kanso/themes.lua | 3 +++ 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/lua/kanso/highlights/editor.lua b/lua/kanso/highlights/editor.lua index 5012a9c..a6e776d 100644 --- a/lua/kanso/highlights/editor.lua +++ b/lua/kanso/highlights/editor.lua @@ -76,21 +76,21 @@ function M.setup(colors, config) -- Normal Normal text. Normal = { fg = theme.ui.fg, bg = config.transparent and theme.ui.none or theme.ui.bg }, -- NormalFloat Normal text in floating windows. - NormalFloat = { fg = theme.ui.float.fg, bg = theme.ui.float.bg }, + NormalFloat = { fg = theme.ui.float.fg, bg = config.transparent and theme.ui.none or theme.ui.float.bg }, -- FloatBorder Border of floating windows. - FloatBorder = { fg = theme.ui.float.fg_border, bg = theme.ui.float.bg_border }, + FloatBorder = { fg = theme.ui.float.fg_border, bg = config.transparent and theme.ui.none or theme.ui.float.bg_border }, -- FloatTitle Title of floating windows. - FloatTitle = { fg = theme.ui.special, bg = theme.ui.float.bg_border, bold = true }, + FloatTitle = { fg = theme.ui.special, bg = config.transparent and theme.ui.none or theme.ui.float.bg_border, bold = true }, -- FloatFooter Footer of floating windows. - FloatFooter = { fg = theme.ui.nontext, bg = theme.ui.float.bg_border }, + FloatFooter = { fg = theme.ui.nontext, bg = config.transparent and theme.ui.none or theme.ui.float.bg_border }, -- NormalNC Normal text in non-current windows. NormalNC = config.dimInactive and { fg = theme.ui.fg_dim, bg = theme.ui.bg_dim } or { link = "Normal" }, -- Pmenu Popup menu: Normal item. - Pmenu = { fg = theme.ui.pmenu.fg, bg = theme.ui.pmenu.bg }, + Pmenu = { fg = theme.ui.pmenu.fg, bg = config.transparent and theme.ui.none or theme.ui.pmenu.bg }, -- PmenuSel Popup menu: Selected item. PmenuSel = { fg = theme.ui.pmenu.fg_sel, bg = theme.ui.pmenu.bg_sel }, -- PmenuKind Popup menu: Normal item "kind". - PmenuKind = { fg = theme.ui.fg_dim, bg = theme.ui.pmenu.bg }, + PmenuKind = { fg = theme.ui.fg_dim, bg = config.transparent and theme.ui.none or theme.ui.pmenu.bg }, -- PmenuKindSel Popup menu: Selected item "kind". PmenuKindSel = { fg = theme.ui.fg_dim, bg = theme.ui.pmenu.bg_sel }, -- PmenuExtra Popup menu: Normal item "extra text". @@ -98,13 +98,13 @@ function M.setup(colors, config) -- PmenuExtraSel Popup menu: Selected item "extra text". PmenuExtraSel = { fg = theme.ui.special, bg = theme.ui.pmenu.bg_sel }, -- PmenuSbar Popup menu: Scrollbar. - PmenuSbar = { bg = theme.ui.pmenu.bg_sbar }, + PmenuSbar = { bg = config.transparent and theme.ui.none or theme.ui.pmenu.bg_sbar }, -- PmenuThumb Popup menu: Thumb of the scrollbar. PmenuThumb = { bg = theme.ui.pmenu.bg_thumb }, -- Question |hit-enter| prompt and yes/no questions. Question = { link = "MoreMsg" }, -- QuickFixLine Current |quickfix| item in the quickfix window. Combined with |hl-CursorLine| when the cursor is there. - QuickFixLine = { bg = theme.ui.bg_p1 }, + QuickFixLine = { bg = config.transparent and theme.ui.none or theme.ui.bg_p1 }, -- Search Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out. Search = { fg = theme.ui.fg, bg = theme.ui.bg_search }, -- SpecialKey Unprintable characters: Text displayed differently from what it really is. But not 'listchars' whitespace. |hl-Whitespace| diff --git a/lua/kanso/highlights/plugins.lua b/lua/kanso/highlights/plugins.lua index 452d480..fb3266b 100644 --- a/lua/kanso/highlights/plugins.lua +++ b/lua/kanso/highlights/plugins.lua @@ -64,7 +64,7 @@ function M.setup(colors, config) NvimTreeExecFile = { fg = theme.syn.string, bold = true }, NvimTreeOpenedFile = { fg = theme.syn.special1, italic = not config.disableItalics }, NvimTreeWinSeparator = { link = "WinSeparator" }, - NvimTreeWindowPicker = { bg = theme.ui.bg_m1, fg = theme.syn.special1, bold = true }, + NvimTreeWindowPicker = { bg = config.transparent and theme.ui.none or theme.ui.bg_m1, fg = theme.syn.special1, bold = true }, -- NeoTree NeoTreeTabInactive = { fg = theme.ui.special, bg = config.transparent and theme.ui.none or theme.ui.bg }, NeoTreeTabActive = { fg = theme.ui.fg_dim, bg = config.transparent and theme.ui.none or theme.ui.bg_p1, bold = true }, @@ -92,7 +92,7 @@ function M.setup(colors, config) DashboardKey = { fg = theme.syn.special1 }, DashboardIcon = { fg = theme.ui.special }, -- Notify - NotifyBackground = { bg = theme.ui.bg }, + NotifyBackground = { bg = config.transparent and theme.ui.none or theme.ui.bg }, NotifyERRORBorder = { link = "DiagnosticError" }, NotifyWARNBorder = { link = "DiagnosticWarn" }, NotifyINFOBorder = { link = "DiagnosticInfo" }, @@ -142,7 +142,7 @@ function M.setup(colors, config) DapUIRestart = { fg = theme.syn.string }, --guifg=#A9FF68" DapUIUnavailable = { fg = theme.syn.comment }, --guifg=#424242" -- Floaterm - FloatermBorder = { fg = theme.ui.float.fg_border, bg = theme.ui.bg }, + FloatermBorder = { fg = theme.ui.float.fg_border, bg = config.transparent and theme.ui.none or theme.ui.bg }, -- NeoVim = {}, healthError = { fg = theme.diag.error }, healthSuccess = { fg = theme.diag.ok }, @@ -358,8 +358,8 @@ function M.setup(colors, config) MiniFilesDirectory = { link = "Directory" }, MiniFilesFile = { fg = theme.ui.fg }, MiniFilesNormal = { link = "NormalFloat" }, - MiniFilesTitle = { fg = theme.ui.special, bg = theme.ui.float.bg_border, bold = true }, - MiniFilesTitleFocused = { fg = theme.ui.fg, bg = theme.ui.float.bg_border, bold = true }, + MiniFilesTitle = { fg = theme.ui.special, bg = config.transparent and theme.ui.none or theme.ui.float.bg_border, bold = true }, + MiniFilesTitleFocused = { fg = theme.ui.fg, bg = config.transparent and theme.ui.none or theme.ui.float.bg_border, bold = true }, MiniHipatternsFixme = { fg = theme.ui.bg, bg = theme.diag.error, bold = true }, MiniHipatternsHack = { fg = theme.ui.bg, bg = theme.diag.warning, bold = true }, @@ -409,7 +409,7 @@ function M.setup(colors, config) MiniPickNormal = { link = "NormalFloat" }, MiniPickPreviewLine = { link = "CursorLine" }, MiniPickPreviewRegion = { link = "IncSearch" }, - MiniPickPrompt = { fg = theme.syn.fun, bg = theme.ui.float.bg_border }, + MiniPickPrompt = { fg = theme.syn.fun, bg = config.transparent and theme.ui.none or theme.ui.float.bg_border }, MiniStarterCurrent = { nocombine = true }, MiniStarterFooter = { fg = theme.syn.deprecated }, @@ -421,9 +421,9 @@ function M.setup(colors, config) MiniStarterSection = { fg = theme.diag.ok }, MiniStarterQuery = { fg = theme.diag.info }, - MiniStatuslineDevinfo = { fg = theme.ui.fg_dim, bg = theme.ui.bg_p1 }, - MiniStatuslineFileinfo = { fg = theme.ui.fg_dim, bg = theme.ui.bg_p1 }, - MiniStatuslineFilename = { fg = theme.ui.fg_dim, bg = theme.ui.bg_dim }, + MiniStatuslineDevinfo = { fg = theme.ui.fg_dim, bg = config.transparent and theme.ui.none or theme.ui.bg_p1 }, + MiniStatuslineFileinfo = { fg = theme.ui.fg_dim, bg = config.transparent and theme.ui.none or theme.ui.bg_p1 }, + MiniStatuslineFilename = { fg = theme.ui.fg_dim, bg = config.transparent and theme.ui.none or theme.ui.bg_dim }, MiniStatuslineInactive = { link = "StatusLineNC" }, MiniStatuslineModeCommand = { fg = theme.ui.bg, bg = theme.syn.operator, bold = true }, MiniStatuslineModeInsert = { fg = theme.ui.bg, bg = theme.diag.ok, bold = true }, @@ -434,7 +434,7 @@ function M.setup(colors, config) MiniSurround = { link = "IncSearch" }, - MiniTablineCurrent = { fg = theme.ui.fg_dim, bg = theme.ui.bg_p1, bold = true }, + MiniTablineCurrent = { fg = theme.ui.fg_dim, bg = config.transparent and theme.ui.none or theme.ui.bg_p1, bold = true }, MiniTablineFill = { link = "TabLineFill" }, MiniTablineHidden = { fg = theme.ui.special, bg = theme.ui.bg_m3 }, MiniTablineModifiedCurrent = { fg = theme.ui.bg_p1, bg = theme.ui.fg_dim, bold = true }, diff --git a/lua/kanso/themes.lua b/lua/kanso/themes.lua index 44365b6..c4de694 100644 --- a/lua/kanso/themes.lua +++ b/lua/kanso/themes.lua @@ -98,6 +98,7 @@ return { zen = function(palette) return { ui = { + none = "NONE", fg = palette.inkWhite, fg_dim = palette.oldWhite, fg_reverse = palette.zenBlue1, @@ -208,6 +209,7 @@ return { ink = function(palette) return { ui = { + none = "NONE", fg = palette.inkWhite, fg_dim = palette.oldWhite, fg_reverse = palette.zenBlue1, @@ -318,6 +320,7 @@ return { pearl = function(palette) return { ui = { + none = "NONE", fg = palette.pearlInk0, fg_dim = palette.pearlInk0, fg_reverse = palette.pearlGray,