File tree 1 file changed +14
-2
lines changed
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -246,8 +246,20 @@ local function setup_theme()
246
246
-- use the provided theme as-is
247
247
return config.options.theme
248
248
elseif type(theme_name) == 'function' then
249
- -- call function and use returned (dynamic) theme as-is
250
- return config.options.theme()
249
+ -- call function and use returned (dyanmic) theme, either as-is or as a string
250
+ local ok, dynamic_theme = pcall(theme_name)
251
+ if ok and (type(dynamic_theme) == 'string') then
252
+ local ok_string, theme = pcall(modules.loader.load_theme, dynamic_theme)
253
+ if ok_string and theme then
254
+ return theme
255
+ end
256
+ elseif ok and (type(dynamic_theme) == 'table') then
257
+ return dynamic_theme
258
+ else
259
+ local error_message = 'Invalid theme type returned from function: ' .. type(dynamic_theme)
260
+ notify_theme_error(error_message)
261
+ return dynamic_theme
262
+ end
251
263
end
252
264
if theme_name ~= 'auto' then
253
265
notify_theme_error(theme_name)
You can’t perform that action at this time.
0 commit comments