···5151---@field clear? boolean clear existing highlight
5252---@field inherit? string inherit other highlight
53535454----@private
5454+local function num_to_hex(color)
5555+ return string.format("#%06X", color)
5656+end
5757+5558---@param opts? {name?: string, link?: boolean}
5659---@param ns? integer
5760---@return vim.api.keyset.hl_info|nil
···6366 if vim.tbl_isempty(hl) then
6467 return nil
6568 end
6666- hl.fg = hl.fg and ("#%06x"):format(hl.fg)
6767- hl.bg = hl.bg and ("#%06x"):format(hl.bg)
6969+ hl.fg = hl.fg and num_to_hex(hl.fg)
7070+ hl.bg = hl.bg and num_to_hex(hl.bg)
6871 return hl
6972end
7073···147150 end
148151149152 local hl = opts.clear and {} or get_hl_as_hex({ name = opts.inherit or name }) or {}
153153+ -- clear cterm
154154+ if not opts.cterm then
155155+ hl.cterm = nil
156156+ end
150157 for attribute, data in pairs(opts) do
151158 if attribute ~= "clear" and attribute ~= "inherit" then
152159 local new_data = resolve_from_attr(data, attribute)