diff --git a/fnl/leap/highlight.fnl b/fnl/leap/highlight.fnl index 266ce75..2929e6f 100644 --- a/fnl/leap/highlight.fnl +++ b/fnl/leap/highlight.fnl @@ -149,15 +149,15 @@ so we set a temporary highlight on it to see where we are." ; Define LeapLabelDimmed. (let [normal (vim.api.nvim_get_hl 0 {:name "Normal" :link false}) label* (vim.api.nvim_get_hl 0 {:name self.group.label :link false})] - ; E.g., the old default color scheme (`vim`) does not define Normal at all. + ; `bg` can be nil (transparent background), and e.g. the old default + ; color scheme (`vim`) does not define Normal at all. ; Also, `nvim_get_hl()` apparently does not guarantee to return numeric ; values in the table (#260). - (when (and (= (type label*.bg) "number") - (= (type normal.bg) "number")) - (set label*.bg (blend label*.bg normal.bg 0.7))) - (when (and (= (type label*.fg) "number") - (= (type normal.fg) "number")) - (set label*.fg (blend label*.fg normal.bg 0.5))) + (when (= (type normal.bg) "number") + (when (= (type label*.bg) "number") + (set label*.bg (blend label*.bg normal.bg 0.7))) + (when (= (type label*.fg) "number") + (set label*.fg (blend label*.fg normal.bg 0.5)))) (vim.api.nvim_set_hl 0 self.group.label-dimmed label*)))) diff --git a/lua/leap/highlight.lua b/lua/leap/highlight.lua index 74b4715..efca9a5 100644 --- a/lua/leap/highlight.lua +++ b/lua/leap/highlight.lua @@ -149,12 +149,15 @@ M["init-highlight"] = function(self, force_3f) end local normal = vim.api.nvim_get_hl(0, {name = "Normal", link = false}) local label_2a = vim.api.nvim_get_hl(0, {name = self.group.label, link = false}) - if ((type(label_2a.bg) == "number") and (type(normal.bg) == "number")) then - label_2a.bg = blend(label_2a.bg, normal.bg, 0.7) - else - end - if ((type(label_2a.fg) == "number") and (type(normal.fg) == "number")) then - label_2a.fg = blend(label_2a.fg, normal.bg, 0.5) + if (type(normal.bg) == "number") then + if (type(label_2a.bg) == "number") then + label_2a.bg = blend(label_2a.bg, normal.bg, 0.7) + else + end + if (type(label_2a.fg) == "number") then + label_2a.fg = blend(label_2a.fg, normal.bg, 0.5) + else + end else end return vim.api.nvim_set_hl(0, self.group["label-dimmed"], label_2a)