breaking: require base_bg in util functions

This commit is contained in:
Michael Chris Lopez
2021-11-12 12:50:27 +08:00
parent 683f76d42a
commit 7f9f04e46e
11 changed files with 25 additions and 21 deletions

View File

@@ -3,6 +3,6 @@ local util = require "zenbones.util"
local M = {}
M.light = util.palette_extend({}, "light")
M.dark = util.palette_extend {}
M.dark = util.palette_extend({}, "dark")
return M

View File

@@ -10,7 +10,7 @@ local M = {}
--- Get global configuration as a table.
---@param prefix string e.g. "zenbones"
---@param base_bg? string light or dark
---@param base_bg string light or dark
function M.get_global_config(prefix, base_bg)
if type(vim.g[prefix]) == "table" then
return vim.g[prefix]
@@ -44,7 +44,7 @@ function M.get_global_config(prefix, base_bg)
}),
common
)
else
elseif base_bg == "dark" then
return vim.tbl_extend(
"keep",
concat_config(prefix, {
@@ -57,6 +57,8 @@ function M.get_global_config(prefix, base_bg)
}),
common
)
else
error(string.format([[Invalid base_bg value: '%s', must be 'light' or 'dark'.]], base_bg))
end
end

View File

@@ -12,7 +12,7 @@ end
--- Auto-fill a palette with the default palette.
---@param p table palette
---@param base_bg? string light or dark
---@param base_bg string light or dark
---@return table<string, table> palette
function M.palette_extend(p, base_bg)
local lush = require "lush"
@@ -40,7 +40,7 @@ function M.palette_extend(p, base_bg)
sky1 = p.sky.sa(20).da(16),
fg1 = p.fg.li(22),
})
else
elseif base_bg == "dark" then
-- default
p = vim.tbl_extend("keep", p, {
bg = hsluv(39, 12, 9), -- sand
@@ -65,6 +65,8 @@ function M.palette_extend(p, base_bg)
sky1 = p.sky.sa(20).li(16),
fg1 = p.fg.da(22),
})
else
error(string.format([[Invalid base_bg value: '%s', must be 'light' or 'dark'.]], base_bg))
end
end