···9999 end)
100100end
101101102102----@param hl_name string
102102+---@param hl string|vim.api.keyset.highlight name or keyset
103103---@return vim.api.keyset.highlight
104104-function utils.reverse_hl(hl_name)
105105- local hl = vim.api.nvim_get_hl(0, { name = hl_name })
104104+function utils.reverse_hl(hl)
105105+ if type(hl) == "string" then
106106+ ---@diagnostic disable-next-line: cast-local-type
107107+ hl = vim.api.nvim_get_hl(0, { name = hl })
108108+ end
109109+106110 if vim.tbl_isempty(hl) or (not hl.fg and not hl.bg and not hl.link) then
107111 return {}
108112 end
109113 if hl.link then
110110- return utils.reverse_hl(hl.link)
114114+ return utils.reverse_hl(hl.link --[[@as string]])
111115 end
112116 local rev = vim.deepcopy(hl)
113117 rev.fg = hl.bg