Skip to content

Commit 2eff404

Browse files
committed
feat: allow highlights table to have functions as well
1 parent 57f6ce3 commit 2eff404

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lua/astroui/config.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
--- },
140140
---}
141141
---```
142-
---@field highlights table<string,table<string,table>>?
142+
---@field highlights table<string,(table<string,table>|fun():table<string,table>)>?
143143
---A table of icons in the UI using NERD fonts
144144
---Example:
145145
---

lua/astroui/init.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ function M.setup(opts)
2222
callback = function()
2323
if vim.g.colors_name then
2424
for _, module in ipairs { "init", vim.g.colors_name } do
25-
for group, spec in pairs(M.config.highlights[module] or {}) do
25+
local highlights = M.config.highlights[module]
26+
if type(highlights) == "function" then highlights = highlights() end
27+
for group, spec in pairs(highlights or {}) do
2628
vim.api.nvim_set_hl(0, group, spec)
2729
end
2830
end

0 commit comments

Comments
 (0)