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