@@ -2,7 +2,31 @@ local M = {}
22
33M .config = require " astroui.config"
44
5- function M .setup (opts ) M .config = vim .tbl_deep_extend (" force" , M .config , opts ) end
5+ function M .setup (opts )
6+ M .config = vim .tbl_deep_extend (" force" , M .config , opts )
7+
8+ vim .api .nvim_create_autocmd ({ " VimEnter" , " ColorScheme" }, {
9+ desc = " Load custom highlights from user configuration" ,
10+ group = vim .api .nvim_create_augroup (" astronvim_highlights" , { clear = true }),
11+ callback = function ()
12+ if vim .g .colors_name then
13+ for _ , module in ipairs { " init" , vim .g .colors_name } do
14+ for group , spec in pairs (M .config .highlights [module ] or {}) do
15+ vim .api .nvim_set_hl (0 , group , spec )
16+ end
17+ end
18+ end
19+ vim .schedule (
20+ function () vim .api .nvim_exec_autocmds (" User" , { pattern = " AstroColorScheme" , modeline = false }) end
21+ )
22+ end ,
23+ })
24+
25+ local colorscheme = M .config .colorscheme
26+ if colorscheme and not pcall (vim .cmd .colorscheme , colorscheme ) then
27+ vim .notify ((" Error setting up colorscheme: `%s`" ):format (colorscheme ), vim .log .levels .ERROR , { title = " AstroUI" })
28+ end
29+ end
630
731--- Get an icon from the AstroNvim internal icons if it is available and return it
832--- @param kind string The kind of icon in astroui.icons to retrieve
0 commit comments