diff --git a/lua/rainbow/internal.lua b/lua/rainbow/internal.lua index b59c33c..305e4d7 100644 --- a/lua/rainbow/internal.lua +++ b/lua/rainbow/internal.lua @@ -156,14 +156,9 @@ local M = {} --- Define highlight groups. This had to be a function to allow an autocmd doing this at colorscheme change. function M.defhl() + local set_hl = vim.api.nvim_set_hl for i = 1, #colors do - local s = string.format( - "highlight default rainbowcol%d guifg=%s ctermfg=%s", - i, - colors[i], - termcolors[i] - ) - vim.cmd(s) + set_hl(0, 'rainbowcol' .. i, { fg = colors[i], ctermfg = termcolors[i] }) end end