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:
Stefan Scherfke 2023-03-31 10:03:47 +02:00 committed by GitHub
parent 4bfc6bc4f3
commit 0ddacf01ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -251,6 +251,9 @@ local function setup_theme()
elseif type(theme_name) == 'table' then
-- use the provided theme as-is
return config.options.theme
elseif type(theme_name) == 'function' then
-- call function and use returned (dynamic) theme as-is
return config.options.theme()
end
if theme_name ~= 'auto' then
notify_theme_error(theme_name)