local M = {} --- copy highlight group ---@param hlgroup string highlight group to copy ---@param namespace? number highlight space ---@return table function M.copyhl(hlgroup, namespace) namespace = namespace or 0 local ok, hl = pcall(vim.api.nvim_get_hl, namespace, { name = hlgroup, create = false }) if not ok then return {} end for _, key in pairs({ "foreground", "background", "special" }) do if hl[key] then hl[key] = string.format("#%06x", hl[key]) end end return hl end return M