diff --git a/lua/ibl/highlights.lua b/lua/ibl/highlights.lua index d14a0b64..b2cbd6de 100644 --- a/lua/ibl/highlights.lua +++ b/lua/ibl/highlights.lua @@ -15,7 +15,16 @@ local M = { } local get = function(name) - return vim.api.nvim_get_hl(0, { name = name }) + local hl + if vim.api.nvim_get_hl then -- check for new neovim 0.9 API + hl = vim.api.nvim_get_hl(0, { name = name }) + else + hl = vim.api.nvim_get_hl_by_name(name, vim.o.termguicolors) + hl.fg, hl.bg = hl.foreground, hl.background + hl.ctermfg, hl.ctermbg = hl.fg, hl.bg + hl.sp = hl.special + end + return hl end local not_set = function(hl) @@ -44,7 +53,7 @@ M.setup = function() local config = conf.get_config(-1) for _, fn in - pairs(hooks.get(-1, hooks.type.HIGHLIGHT_SETUP) --[[ @as ibl.hooks.cb.highlight_setup[] ]]) + pairs(hooks.get(-1, hooks.type.HIGHLIGHT_SETUP) --[[ @as ibl.hooks.cb.highlight_setup[] ]]) do fn() end