2021-09-04 17:18:50 +00:00
|
|
|
local lualine_require = require 'lualine_require'
|
|
|
|
local modules = lualine_require.lazy_require {
|
|
|
|
utils_notices = 'lualine.utils.notices',
|
2021-09-04 17:17:19 +00:00
|
|
|
}
|
2021-09-04 17:18:50 +00:00
|
|
|
local sep = package.config:sub(1, 1)
|
|
|
|
local wal_colors_path = table.concat({ os.getenv 'HOME', '.cache', 'wal', 'colors.sh' }, sep)
|
|
|
|
local wal_colors_file = io.open(wal_colors_path, 'r')
|
2021-09-04 17:17:19 +00:00
|
|
|
|
|
|
|
if wal_colors_file == nil then
|
2021-09-04 17:18:50 +00:00
|
|
|
modules.utils_notices.add_notice('lualine.nvim: ' .. wal_colors_path .. ' not found')
|
|
|
|
error ''
|
2021-09-04 17:17:19 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
local ok, wal_colors_text = pcall(wal_colors_file.read, wal_colors_file, '*a')
|
|
|
|
wal_colors_file:close()
|
|
|
|
|
|
|
|
if not ok then
|
2021-09-04 17:18:50 +00:00
|
|
|
modules.utils_notices.add_notice('lualine.nvim: ' .. wal_colors_path .. ' could not be read: ' .. wal_colors_text)
|
|
|
|
error ''
|
2021-09-04 17:17:19 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
local colors = {}
|
|
|
|
|
|
|
|
for line in vim.gsplit(wal_colors_text, '\n') do
|
2021-09-04 17:18:50 +00:00
|
|
|
if line:match "^[a-z0-9]+='#[a-f0-9]+'" ~= nil then
|
|
|
|
local i = line:find '='
|
2021-09-04 17:17:19 +00:00
|
|
|
local key = line:sub(0, i - 1)
|
|
|
|
local value = line:sub(i + 2, #line - 1)
|
|
|
|
colors[key] = value
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return {
|
|
|
|
normal = {
|
2021-09-04 17:18:50 +00:00
|
|
|
a = { fg = colors.background, bg = colors.color4, gui = 'bold' },
|
|
|
|
b = { fg = colors.foreground, bg = colors.color8 },
|
|
|
|
c = { fg = colors.foreground, bg = colors.background },
|
2021-09-04 17:17:19 +00:00
|
|
|
},
|
2021-09-04 17:18:50 +00:00
|
|
|
insert = { a = { fg = colors.background, bg = colors.color2, gui = 'bold' } },
|
|
|
|
visual = { a = { fg = colors.background, bg = colors.color3, gui = 'bold' } },
|
|
|
|
replace = { a = { fg = colors.background, bg = colors.color1, gui = 'bold' } },
|
2021-09-04 17:17:19 +00:00
|
|
|
inactive = {
|
2021-09-04 17:18:50 +00:00
|
|
|
a = { fg = colors.foreground, bg = colors.background, gui = 'bold' },
|
|
|
|
b = { fg = colors.foreground, bg = colors.background },
|
|
|
|
c = { fg = colors.foreground, bg = colors.background },
|
|
|
|
},
|
2021-09-04 17:17:19 +00:00
|
|
|
}
|