feat: allow specifying theme as function (#998)
Use case: I have a custom theme that dynamically adjusts to the OS' dark/light mode. If the theme can be a function, that function can return the proper color values each time it is called.
This commit is contained in:
parent
4bfc6bc4f3
commit
0ddacf01ed
|
@ -251,6 +251,9 @@ local function setup_theme()
|
||||||
elseif type(theme_name) == 'table' then
|
elseif type(theme_name) == 'table' then
|
||||||
-- use the provided theme as-is
|
-- use the provided theme as-is
|
||||||
return config.options.theme
|
return config.options.theme
|
||||||
|
elseif type(theme_name) == 'function' then
|
||||||
|
-- call function and use returned (dynamic) theme as-is
|
||||||
|
return config.options.theme()
|
||||||
end
|
end
|
||||||
if theme_name ~= 'auto' then
|
if theme_name ~= 'auto' then
|
||||||
notify_theme_error(theme_name)
|
notify_theme_error(theme_name)
|
||||||
|
|
Loading…
Reference in New Issue