From b5bebc2db619cf55cea7fd230493d220352489c0 Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Mon, 10 Oct 2022 21:08:26 +0200 Subject: [PATCH] vim: make a proper `lualine` theme and support light background --- config/nvim/after/plugin/lualine.lua | 53 +++----------------- config/nvim/lua/lualine/themes/solarized.lua | 26 ++++++++++ 2 files changed, 32 insertions(+), 47 deletions(-) create mode 100644 config/nvim/lua/lualine/themes/solarized.lua diff --git a/config/nvim/after/plugin/lualine.lua b/config/nvim/after/plugin/lualine.lua index cbd2b59..68e4cc0 100644 --- a/config/nvim/after/plugin/lualine.lua +++ b/config/nvim/after/plugin/lualine.lua @@ -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 } }, diff --git a/config/nvim/lua/lualine/themes/solarized.lua b/config/nvim/lua/lualine/themes/solarized.lua new file mode 100644 index 0000000..0fde0a1 --- /dev/null +++ b/config/nvim/lua/lualine/themes/solarized.lua @@ -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 }, + }, +} +