vim: make a proper lualine theme and support light background

This commit is contained in:
Fernando Schauenburg 2022-10-10 21:08:26 +02:00
parent b17f89a14b
commit b5bebc2db6
2 changed files with 32 additions and 47 deletions

View file

@ -10,44 +10,6 @@ local Table = {
end
}
local colors = require'fs.util'.colors()
local theme = (function()
local active = {
a = Table:new { fg = colors.base03, bg = colors.base1 },
b = Table:new { fg = colors.base03, bg = colors.base0 },
c = Table:new { fg = colors.base1, bg = colors.base02 },
}
local inactive = {
a = { fg = colors.base02, bg = colors.base00 },
b = { fg = colors.base02, bg = colors.base01 },
c = { fg = colors.base01, bg = colors.base03 },
}
return {
normal = {
a = active.a:override { bg = colors.blue },
b = active.b,
c = active.c,
},
insert = {
a = active.a:override { bg = colors.green },
},
visual = {
a = active.a:override { bg = colors.magenta },
},
replace = {
a = active.a:override { bg = colors.red },
},
inactive = {
a = inactive.a,
b = inactive.b,
c = inactive.c,
},
}
end)()
local MODE_MAP = {
['n'] = 'Normal ',
['no'] = 'O-Pend ',
@ -106,6 +68,7 @@ end
local window_is_wide = window_is_at_least(80)
local window_is_medium = window_is_at_least(50)
local C = require'fs.util'.colors()
local parts = {
split = { function() return '%=' end, padding = 0 },
@ -116,7 +79,7 @@ local parts = {
paste = {
function() return '' end,
color = { fg = colors.base03, bg = colors.yellow, gui = 'bold' },
color = { fg = C.base03, bg = C.yellow, gui = 'bold' },
cond = function()
return vim.opt.paste:get()
end
@ -137,9 +100,9 @@ local parts = {
diff = {
diff,
diff_color = {
added = { fg = colors.green },
modified = { fg = colors.yellow },
removed = { fg = colors.orange },
added = { fg = C.green },
modified = { fg = C.yellow },
removed = { fg = C.orange },
},
padding = 0,
cond = window_is_wide,
@ -179,10 +142,6 @@ local parts = {
return chars[math.ceil(#chars * current / total)]
end,
padding = { left = 0, right = 1 },
color = {
fg = theme.normal.b.bg,
bg = theme.normal.c.bg,
},
cond = window_is_wide,
},
@ -203,7 +162,7 @@ require('lualine').setup {
icons_enabled = true,
component_separators = { left = '', right = '' },
section_separators = { left = '', right = '' },
theme = theme,
theme = 'solarized',
},
sections = sections:override { lualine_a = { parts.mode, parts.paste } },

View file

@ -0,0 +1,26 @@
local C = require'fs.util'.colors()
local a_fg = C.base03
return {
normal = {
a = { fg = a_fg, bg = C.blue },
b = { fg = C.base03, bg = C.base0 },
c = { fg = C.base1, bg = C.base02 },
},
insert = {
a = { fg = a_fg, bg = C.green },
},
visual = {
a = { fg = a_fg, bg = C.magenta },
},
replace = {
a = { fg = a_fg, bg = C.red },
},
inactive = {
a = { fg = C.base02, bg = C.base00 },
b = { fg = C.base02, bg = C.base01 },
c = { fg = C.base01, bg = C.base03 },
},
}