Set vim.o.background to the correct value when not using 'auto'

This commit is contained in:
Jan Polak 2023-12-07 05:28:13 +01:00
parent d7ab1515c4
commit 28cae122a9

View File

@ -50,71 +50,78 @@ local base_colors = {
local variants = { local variants = {
dark = { dark = {
_name = 'dark', _name = 'dark',
['bg'] = base_colors['flexoki-black'], background = 'dark',
['bg-2'] = base_colors['flexoki-950'], ['bg'] = base_colors['flexoki-black'],
['ui'] = base_colors['flexoki-900'], ['bg-2'] = base_colors['flexoki-950'],
['ui-2'] = base_colors['flexoki-850'], ['ui'] = base_colors['flexoki-900'],
['ui-3'] = base_colors['flexoki-800'], ['ui-2'] = base_colors['flexoki-850'],
['tx-3'] = base_colors['flexoki-700'], ['ui-3'] = base_colors['flexoki-800'],
['tx-2'] = base_colors['flexoki-500'], ['tx-3'] = base_colors['flexoki-700'],
['tx'] = base_colors['flexoki-200'], ['tx-2'] = base_colors['flexoki-500'],
['re'] = base_colors['flexoki-red-400'], ['tx'] = base_colors['flexoki-200'],
['re-2'] = base_colors['flexoki-red-600'], ['re'] = base_colors['flexoki-red-400'],
['or'] = base_colors['flexoki-orange-400'], ['re-2'] = base_colors['flexoki-red-600'],
['or-2'] = base_colors['flexoki-orange-600'], ['or'] = base_colors['flexoki-orange-400'],
['ye'] = base_colors['flexoki-yellow-400'], ['or-2'] = base_colors['flexoki-orange-600'],
['ye-2'] = base_colors['flexoki-yellow-600'], ['ye'] = base_colors['flexoki-yellow-400'],
['gr'] = base_colors['flexoki-green-400'], ['ye-2'] = base_colors['flexoki-yellow-600'],
['gr-2'] = base_colors['flexoki-green-600'], ['gr'] = base_colors['flexoki-green-400'],
['cy'] = base_colors['flexoki-cyan-400'], ['gr-2'] = base_colors['flexoki-green-600'],
['cy-2'] = base_colors['flexoki-cyan-600'], ['cy'] = base_colors['flexoki-cyan-400'],
['bl'] = base_colors['flexoki-blue-400'], ['cy-2'] = base_colors['flexoki-cyan-600'],
['bl-2'] = base_colors['flexoki-blue-600'], ['bl'] = base_colors['flexoki-blue-400'],
['pu'] = base_colors['flexoki-purple-400'], ['bl-2'] = base_colors['flexoki-blue-600'],
['pu-2'] = base_colors['flexoki-purple-600'], ['pu'] = base_colors['flexoki-purple-400'],
['ma'] = base_colors['flexoki-magenta-400'], ['pu-2'] = base_colors['flexoki-purple-600'],
['ma-2'] = base_colors['flexoki-magenta-600'], ['ma'] = base_colors['flexoki-magenta-400'],
['ma-2'] = base_colors['flexoki-magenta-600'],
}, },
light = { light = {
_name = 'light', _name = 'light',
['bg'] = base_colors['flexoki-paper'], background = 'light',
['bg-2'] = base_colors['flexoki-50'], ['bg'] = base_colors['flexoki-paper'],
['ui'] = base_colors['flexoki-100'], ['bg-2'] = base_colors['flexoki-50'],
['ui-2'] = base_colors['flexoki-150'], ['ui'] = base_colors['flexoki-100'],
['ui-3'] = base_colors['flexoki-200'], ['ui-2'] = base_colors['flexoki-150'],
['tx-3'] = base_colors['flexoki-300'], ['ui-3'] = base_colors['flexoki-200'],
['tx-2'] = base_colors['flexoki-600'], ['tx-3'] = base_colors['flexoki-300'],
['tx'] = base_colors['flexoki-black'], ['tx-2'] = base_colors['flexoki-600'],
['re'] = base_colors['flexoki-red-600'], ['tx'] = base_colors['flexoki-black'],
['re-2'] = base_colors['flexoki-red-400'], ['re'] = base_colors['flexoki-red-600'],
['or'] = base_colors['flexoki-orange-600'], ['re-2'] = base_colors['flexoki-red-400'],
['or-2'] = base_colors['flexoki-orange-400'], ['or'] = base_colors['flexoki-orange-600'],
['ye'] = base_colors['flexoki-yellow-600'], ['or-2'] = base_colors['flexoki-orange-400'],
['ye-2'] = base_colors['flexoki-yellow-400'], ['ye'] = base_colors['flexoki-yellow-600'],
['gr'] = base_colors['flexoki-green-600'], ['ye-2'] = base_colors['flexoki-yellow-400'],
['gr-2'] = base_colors['flexoki-green-400'], ['gr'] = base_colors['flexoki-green-600'],
['cy'] = base_colors['flexoki-cyan-600'], ['gr-2'] = base_colors['flexoki-green-400'],
['cy-2'] = base_colors['flexoki-cyan-400'], ['cy'] = base_colors['flexoki-cyan-600'],
['bl'] = base_colors['flexoki-blue-600'], ['cy-2'] = base_colors['flexoki-cyan-400'],
['bl-2'] = base_colors['flexoki-blue-400'], ['bl'] = base_colors['flexoki-blue-600'],
['pu'] = base_colors['flexoki-purple-600'], ['bl-2'] = base_colors['flexoki-blue-400'],
['pu-2'] = base_colors['flexoki-purple-400'], ['pu'] = base_colors['flexoki-purple-600'],
['ma'] = base_colors['flexoki-magenta-600'], ['pu-2'] = base_colors['flexoki-purple-400'],
['ma-2'] = base_colors['flexoki-magenta-400'], ['ma'] = base_colors['flexoki-magenta-600'],
['ma-2'] = base_colors['flexoki-magenta-400'],
} }
} }
M.palette = function () M.palette = function ()
local variant = {}
if config.options.variant == 'auto' then if config.options.variant == 'auto' then
if vim.o.background == 'dark' then if vim.o.background == 'dark' then
return variants[config.options.dark_variant] variant = variants[config.options.dark_variant]
else else
return variants[config.options.light_variant] variant = variants[config.options.light_variant]
end end
else else
return variants[config.options.variant] variant = variants[config.options.variant]
vim.o.background = variant.background
end end
return variant
end end
return M return M