Skip to content
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.

Commit

Permalink
fix: plugin not work when colors are more than termcolors
Browse files Browse the repository at this point in the history
If you defined `{colors = { "#cc241d", "#a89984" }, termcolors = {}}`, you can't reproduce the issue.
Because there are seven colors and termcolors in default config.

If you defined colors more than seven,

    colors = { "#cc241d", "#a89984", "#b16286", "#d79921", "#689d6a", "#d65d0e", "#458588", "#005f87" },
    termcolors = {},

Or colors' length more than termcolors',

    colors = { "#cc241d", "#a89984"},
    termcolors = { 3 },

then the issue can be reproduced.

close #120
  • Loading branch information
adoyle-h committed Sep 14, 2022
1 parent 620a24f commit 5123156
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lua/rainbow/internal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 5123156

Please sign in to comment.