pass colors from builder

This commit is contained in:
Michael Chris Lopez
2021-09-14 07:50:23 +08:00
parent e300373fe5
commit d60fc8aeef
8 changed files with 43 additions and 43 deletions

View File

@@ -16,8 +16,26 @@ end
local function build()
local templates = { "vim", "kitty", "alacritty", "wezterm", "lualine", "lightline", "tmux" }
for _, t in ipairs(templates) do
write_template(unpack(require("zenbones.build." .. t) "zenbones"))
write_template(unpack(require("zenbones.build." .. t) "zenflesh"))
write_template(
unpack(
require("zenbones.build." .. t)(
"zenbones",
require "zenbones",
require "zenbones.palette",
require "zenbones.terminal"
)
)
)
write_template(
unpack(
require("zenbones.build." .. t)(
"zenflesh",
require "zenflesh",
require "zenflesh.palette",
require "zenflesh.terminal"
)
)
)
end
end

View File

@@ -26,10 +26,7 @@ colors:
white: '${color15}'
]]
return function(name)
local theme = require(name)
local terminal = require(name .. ".terminal")
return function(name, theme, palette, terminal)
local values = {
name = name,
bg = theme.Normal.bg.hex,

View File

@@ -39,10 +39,7 @@ color14 ${color14}
color15 ${color15}
]]
return function(name)
local theme = require(name)
local terminal = require(name .. ".terminal")
return function(name, theme, palette, terminal)
local bg = theme.Normal.bg.hex
local fg = theme.Normal.fg.hex
local values = {

View File

@@ -22,9 +22,7 @@ let s:p.tabline.tabsel = [ [ "${tabsel_fg}", "${tabsel_bg}", "bold" ] ]
let g:lightline#colorscheme#zenbones#palette = lightline#colorscheme#fill(s:p)
]]
return function(name)
local theme = require(name)
return function(name, theme, palette, terminal)
return {
string.format("autoload/lightline/colorscheme/%s.vim", name),
template,

View File

@@ -33,9 +33,7 @@ return {
}
]]
return function(name)
local theme = require(name)
return function(name, theme, palette, terminal)
return {
string.format("lua/lualine/themes/%s.lua", name),
template,

View File

@@ -17,10 +17,7 @@ set -g clock-mode-colour '${color5}'
set -g mode-style fg='${color0}',bg='${selection_background}'
]]
return function(name)
local theme = require(name)
local terminal = require(name .. ".terminal")
return function(name, theme, palette, terminal)
local values = {
selection_background = theme.Visual.bg.hex,
}

View File

@@ -34,25 +34,23 @@ endif
${vimcolors}
]]
return function(name)
local theme = require(name)
local terminal = require(name .. ".terminal")
local termcolors = ""
for i, v in ipairs(terminal.colors) do
termcolors = termcolors .. string.format("let g:terminal_color_%s = '%s'\n", (i - 1), v.hex)
end
return function(name, theme, palette, terminal)
local termcolors = ""
for i, v in ipairs(terminal.colors) do
termcolors = termcolors .. string.format("let g:terminal_color_%s = '%s'\n", (i - 1), v.hex)
end
-- Compile lush table, concatenate to a single string, and remove blend property
local vimcolors = table.concat(vim.fn.sort(lush.compile(theme, { exclude_keys = { "blend" } })), "\n")
-- Compile lush table, concatenate to a single string, and remove blend property
local vimcolors = table.concat(vim.fn.sort(lush.compile(theme, { exclude_keys = { "blend" } })), "\n")
return {
string.format("colors/%s.vim", name),
template,
{
background = name == "zenbones" and "light" or "dark",
name = name,
termcolors = termcolors,
vimcolors = vimcolors,
},
}
return {
string.format("colors/%s.vim", name),
template,
{
background = name == "zenbones" and "light" or "dark",
name = name,
termcolors = termcolors,
vimcolors = vimcolors,
},
}
end

View File

@@ -12,10 +12,7 @@ ansi = ["${color0}", "${color1}", "${color2}", "${color3}", "${color4}", "${colo
brights = ["${color8}", "${color9}", "${color10}", "${color11}", "${color12}", "${color13}", "${color14}", "${color15}"]
]]
return function(name)
local theme = require(name)
local terminal = require(name .. ".terminal")
return function(name, theme, palette, terminal)
local name = name:sub(1, 1):upper() .. name:sub(2)
local values = {