Skip to content

Commit

Permalink
fix(highlights): avoid NONE backgrounds for some custom groups (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramojus committed Aug 10, 2024
1 parent 5303a51 commit 884d711
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lua/mellifluous/highlights/custom_groups.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
local M = {}

local function fallback_if_none(color, fallback_color)
if type(color) == "string" and color == "NONE" then
return fallback_color
end
return color
end

-- Any shared highlight groups that cannot be found in general highlights or
-- treesitter highlights are created here.

function M.get(colors)
local config = require("mellifluous.config").config
local shader = require("mellifluous.utils.shader")
Expand All @@ -11,9 +17,11 @@ function M.get(colors)
MainKeyword = { fg = colors.main_keywords, style = config.styles.keywords },

IndentLine = function(bg)
bg = fallback_if_none(bg, colors.bg)
return { fg = shader.replicate_shade(colors.bg, colors.fg5, bg) }
end,
IndentLineInactive = function(bg)
bg = fallback_if_none(bg, colors.bg)
return {
fg = config.is_bg_dark and shader.replicate_shade(colors.bg, colors.bg4, bg)
or shader.replicate_shade(colors.bg, colors.dark_bg2, bg),
Expand All @@ -22,6 +30,7 @@ function M.get(colors)

MenuButton = { fg = colors.ui_blue },
MenuButtonSelected = function(bg)
bg = fallback_if_none(bg, colors.bg)
local applied_bg = config.is_bg_dark and shader.replicate_shade(colors.bg, colors.bg4, bg)
or shader.replicate_shade(colors.bg, colors.dark_bg2, bg)
return {
Expand Down

0 comments on commit 884d711

Please sign in to comment.