2021-10-11 13:56:02 +08:00
|
|
|
local M = {}
|
|
|
|
|
|
2021-10-28 18:24:46 +08:00
|
|
|
local function concat_config(prefix, suffixes)
|
2021-10-26 18:21:21 +08:00
|
|
|
local config = {}
|
2021-10-29 15:00:22 +08:00
|
|
|
for _i, suffix in ipairs(suffixes) do
|
2021-10-26 18:21:21 +08:00
|
|
|
config[suffix] = vim.g[prefix .. "_" .. suffix]
|
|
|
|
|
end
|
|
|
|
|
return config
|
|
|
|
|
end
|
|
|
|
|
|
2021-10-11 14:38:05 +08:00
|
|
|
function M.get_global_config(prefix, base_bg)
|
2021-10-27 16:49:45 +08:00
|
|
|
if type(vim.g[prefix]) == "table" then
|
|
|
|
|
return vim.g[prefix]
|
|
|
|
|
end
|
|
|
|
|
|
2021-10-26 18:21:21 +08:00
|
|
|
local common = concat_config(prefix, {
|
|
|
|
|
"solid_vert_split",
|
|
|
|
|
"solid_float_border",
|
|
|
|
|
"solid_line_nr",
|
|
|
|
|
"italic_comments",
|
|
|
|
|
})
|
|
|
|
|
|
2021-10-11 14:38:05 +08:00
|
|
|
if base_bg == "light" then
|
2021-10-20 17:30:26 +08:00
|
|
|
if vim.g[prefix .. "_dim_noncurrent_window"] then
|
|
|
|
|
vim.notify(
|
|
|
|
|
prefix .. "_dim_noncurrent_window is replaced by " .. prefix .. "_darken_noncurrent_window",
|
|
|
|
|
vim.log.levels.ERROR,
|
|
|
|
|
{ title = "zenbones" }
|
|
|
|
|
)
|
|
|
|
|
end
|
2021-10-26 18:21:21 +08:00
|
|
|
return vim.tbl_extend(
|
|
|
|
|
"keep",
|
|
|
|
|
concat_config(prefix, {
|
|
|
|
|
"lightness",
|
|
|
|
|
"darken_noncurrent_window",
|
|
|
|
|
"darken_comments",
|
|
|
|
|
"darken_line_nr",
|
|
|
|
|
"darken_non_text",
|
|
|
|
|
}),
|
|
|
|
|
common
|
|
|
|
|
)
|
2021-10-11 14:38:05 +08:00
|
|
|
else
|
2021-10-26 18:21:21 +08:00
|
|
|
return vim.tbl_extend(
|
|
|
|
|
"keep",
|
|
|
|
|
concat_config(prefix, {
|
|
|
|
|
"darkness",
|
|
|
|
|
"lighten_noncurrent_window",
|
|
|
|
|
"lighten_comments",
|
|
|
|
|
"lighten_line_nr",
|
|
|
|
|
"lighten_non_text",
|
|
|
|
|
}),
|
|
|
|
|
common
|
|
|
|
|
)
|
2021-10-11 13:56:02 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2021-10-11 14:38:05 +08:00
|
|
|
function M.generate(p, base_bg, opt)
|
|
|
|
|
return require("zenbones.specs." .. base_bg)(p, opt)
|
2021-10-11 13:56:02 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return M
|