update build to derive term colors

This commit is contained in:
Michael Chris Lopez
2021-10-10 13:43:40 +08:00
parent 79d7ffd17f
commit 8e9a4cbd91
13 changed files with 83 additions and 93 deletions

View File

@@ -19,7 +19,7 @@ colors:
bright:
black: '#B3C6B6'
red: '#94253E'
green: '#466522'
green: '#3F5A22'
yellow: '#803D1C'
blue: '#1D5573'
magenta: '#7B3B70'

View File

@@ -37,9 +37,9 @@
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.3960784313725490</real>
<real>0.3529411764705883</real>
<key>Red Component</key>
<real>0.2745098039215687</real>
<real>0.2470588235294118</real>
</dict>
<key>Ansi 11 Color</key>
<dict>

View File

@@ -32,7 +32,7 @@ color7 #202E18
# bright
color8 #B3C6B6
color9 #94253E
color10 #466522
color10 #3F5A22
color11 #803D1C
color12 #1D5573
color13 #7B3B70

View File

@@ -10,4 +10,4 @@ selection_bg = "#B1EA90"
selection_fg = "#202E18"
ansi = ["#E5EDE6", "#A8334C", "#567A30", "#944927", "#286486", "#88507D", "#3B8992", "#202E18"]
brights = ["#B3C6B6", "#94253E", "#466522", "#803D1C", "#1D5573", "#7B3B70", "#2B747C", "#415934"]
brights = ["#B3C6B6", "#94253E", "#3F5A22", "#803D1C", "#1D5573", "#7B3B70", "#2B747C", "#415934"]

View File

@@ -8,12 +8,12 @@ local function write_template(path, template, values)
file:close()
end
function build(name, specs, palette, terminal, options)
function build(name, specs, palette, options)
local exclude = options.exclude or {}
local templates = { "vim", "iterm", "kitty", "alacritty", "wezterm", "lualine", "lightline", "tmux" }
for _, t in ipairs(templates) do
if not vim.tbl_contains(exclude, t) then
write_template(unpack(require("zenbones.template." .. t)(name, specs, palette, terminal)))
write_template(unpack(require("zenbones.template." .. t)(name, specs, palette)))
end
end
end
@@ -24,7 +24,7 @@ function M.run()
-- default
package.loaded["zenbones"] = nil
local p = require "zenbones.palette"
build("zenbones", require "zenbones", p, require("zenbones.term").colors, {})
build("zenbones", require "zenbones", p, {})
-- bright
package.loaded["zenbones"] = nil
@@ -33,7 +33,6 @@ function M.run()
"zenbones_bright",
require "zenbones",
require "zenbones.palette",
require("zenbones.term").colors,
{ exclude = { "vim", "lightline", "lualine" } }
)
vim.api.nvim_del_var "zenbones_lightness"
@@ -45,14 +44,13 @@ function M.run()
"zenbones_dim",
require "zenbones",
require "zenbones.palette",
require("zenbones.term").colors,
{ exclude = { "vim", "lightline", "lualine" } }
)
vim.api.nvim_del_var "zenbones_lightness"
-- default
package.loaded["zenflesh"] = nil
build("zenflesh", require "zenflesh", require "zenflesh.palette", require("zenflesh.term").colors, {})
build("zenflesh", require "zenflesh", require "zenflesh.palette", {})
-- stark
package.loaded["zenflesh"] = nil
@@ -61,7 +59,6 @@ function M.run()
"zenflesh_stark",
require "zenflesh",
require "zenflesh.palette",
require("zenflesh.term").colors,
{ exclude = { "vim", "lightline", "lualine" } }
)
vim.api.nvim_del_var "zenflesh_darkness"
@@ -73,32 +70,19 @@ function M.run()
"zenflesh_warm",
require "zenflesh",
require "zenflesh.palette",
require("zenflesh.term").colors,
{ exclude = { "vim", "lightline", "lualine" } }
)
vim.api.nvim_del_var "zenflesh_darkness"
-- neobones light
package.loaded["zenbones.neobones"] = nil
package.loaded["neobones"] = nil
vim.opt.background = "light"
build(
"neobones_light",
require "zenbones.neobones",
require "zenbones.neobones.palette",
require("zenbones.neobones.term").colors.zenbones,
{ exclude = { "vim" } }
)
build("neobones_light", require "neobones", require("neobones.palette").zenbones, { exclude = { "vim" } })
-- neobones dark
package.loaded["zenbones.neobones"] = nil
package.loaded["neobones"] = nil
vim.opt.background = "dark"
build(
"neobones_dark",
require "zenbones.neobones",
require "zenbones.neobones.palette",
require("zenbones.neobones.term").colors.zenflesh,
{ exclude = { "vim" } }
)
build("neobones_dark", require "neobones", require("neobones.palette").zenflesh, { exclude = { "vim" } })
end
return M

View File

@@ -27,11 +27,12 @@ colors:
white: '${color15}'
]]
return function(name, theme, palette, term)
return function(name, specs, p)
local term = require("zenbones.term").colors_map(p)
local values = {
name = name,
bg = theme.Normal.bg.hex,
fg = theme.Normal.fg.hex,
bg = specs.Normal.bg.hex,
fg = specs.Normal.fg.hex,
}
for i, v in ipairs(term) do
values["color" .. (i - 1)] = v.hex

View File

@@ -43,7 +43,8 @@ local function key_to_xml(key, color)
return xml
end
return function(name, theme, palette, term)
return function(name, specs, p)
local term = require("zenbones.term").colors_map(p)
local colors = {
["Ansi 0"] = term[1],
["Ansi 1"] = term[2],
@@ -61,17 +62,17 @@ return function(name, theme, palette, term)
["Ansi 13"] = term[14],
["Ansi 14"] = term[15],
["Ansi 15"] = term[16],
Foreground = theme.Normal.fg,
Background = theme.Normal.bg,
Foreground = specs.Normal.fg,
Background = specs.Normal.bg,
Bold = term[9],
Cursor = theme.Cursor.bg,
["Cursor Text"] = theme.Cursor.fg,
["Cursor Guide"] = theme.CursorLine.bg,
Cursor = specs.Cursor.bg,
["Cursor Text"] = specs.Cursor.fg,
["Cursor Guide"] = specs.CursorLine.bg,
Link = term[13],
Selection = theme.Visual.bg,
["Selected Text"] = theme.Normal.fg,
Badge = theme.Comment.fg,
Tab = theme.Normal.bg,
Selection = specs.Visual.bg,
["Selected Text"] = specs.Normal.fg,
Badge = specs.Comment.fg,
Tab = specs.Normal.bg,
}
local template = start_template

View File

@@ -40,20 +40,21 @@ color14 ${color14}
color15 ${color15}
]]
return function(name, theme, palette, term)
local bg = theme.Normal.bg.hex
local fg = theme.Normal.fg.hex
return function(name, specs, p)
local term = require("zenbones.term").colors_map(p)
local bg = specs.Normal.bg.hex
local fg = specs.Normal.fg.hex
local values = {
name = name,
background = bg,
foreground = fg,
selection_background = theme.Visual.bg.hex,
selection_background = specs.Visual.bg.hex,
selection_foreground = fg,
url_color = term[13].hex,
cursor = fg,
active_tab_background = theme.Search.bg.hex,
active_tab_background = specs.Search.bg.hex,
active_tab_foreground = fg,
inactive_tab_background = theme.StatusLine.bg.hex,
inactive_tab_background = specs.StatusLine.bg.hex,
inactive_tab_foreground = fg,
}
for i, v in ipairs(term) do

View File

@@ -23,31 +23,31 @@ let s:p.tabline.tabsel = [ [ "${tabsel_fg}", "${tabsel_bg}", "bold" ] ]
let g:lightline#colorscheme#zenbones#palette = lightline#colorscheme#fill(s:p)
]]
return function(name, theme, palette, terminal)
return function(name, specs, p)
return {
string.format("autoload/lightline/colorscheme/%s.vim", name),
template,
{
common_fg = theme.Folded.fg.hex,
inactive_bg = theme.StatusLineNC.bg.hex,
inactive_fg = theme.StatusLineNC.fg.hex,
normal_a_bg = theme.PmenuSbar.bg.hex,
normal_b_bg = theme.PmenuSel.bg.hex,
normal_c_bg = theme.StatusLine.bg.hex,
normal_c_fg = theme.StatusLine.fg.hex,
insert_a_bg = theme.DiffText.bg.hex,
visual_a_bg = theme.Visual.bg.hex,
replace_a_bg = theme.DiffDelete.bg.hex,
tabline_left_bg = theme.PmenuSel.bg.hex,
tabline_left_fg = theme.Normal.fg.hex,
tabline_right_bg = theme.PmenuSel.bg.hex,
tabline_right_fg = theme.Normal.fg.hex,
tabsel_bg = theme.Normal.bg.hex,
tabsel_fg = theme.Normal.fg.hex,
warning_bg = theme.DiagnosticVirtualTextWarn.bg.hex,
warning_fg = theme.DiagnosticVirtualTextWarn.fg.hex,
error_bg = theme.LspDiagnosticsVirtualTextError.bg.hex,
error_fg = theme.LspDiagnosticsVirtualTextError.fg.hex,
common_fg = specs.Folded.fg.hex,
inactive_bg = specs.StatusLineNC.bg.hex,
inactive_fg = specs.StatusLineNC.fg.hex,
normal_a_bg = specs.PmenuSbar.bg.hex,
normal_b_bg = specs.PmenuSel.bg.hex,
normal_c_bg = specs.StatusLine.bg.hex,
normal_c_fg = specs.StatusLine.fg.hex,
insert_a_bg = specs.DiffText.bg.hex,
visual_a_bg = specs.Visual.bg.hex,
replace_a_bg = specs.DiffDelete.bg.hex,
tabline_left_bg = specs.PmenuSel.bg.hex,
tabline_left_fg = specs.Normal.fg.hex,
tabline_right_bg = specs.PmenuSel.bg.hex,
tabline_right_fg = specs.Normal.fg.hex,
tabsel_bg = specs.Normal.bg.hex,
tabsel_fg = specs.Normal.fg.hex,
warning_bg = specs.DiagnosticVirtualTextWarn.bg.hex,
warning_fg = specs.DiagnosticVirtualTextWarn.fg.hex,
error_bg = specs.LspDiagnosticsVirtualTextError.bg.hex,
error_fg = specs.LspDiagnosticsVirtualTextError.fg.hex,
},
}
end

View File

@@ -34,22 +34,22 @@ return {
}
]]
return function(name, theme, palette, terminal)
return function(name, specs, p)
return {
string.format("lua/lualine/themes/%s.lua", name),
template,
{
common_fg = theme.Folded.fg.hex,
inactive_bg = theme.StatusLineNC.bg.hex,
inactive_fg = theme.StatusLineNC.fg.hex,
normal_a_bg = theme.PmenuSbar.bg.hex,
normal_b_bg = theme.PmenuSel.bg.hex,
normal_c_bg = theme.StatusLine.bg.hex,
normal_c_fg = theme.StatusLine.fg.hex,
insert_a_bg = theme.DiffText.bg.hex,
command_a_bg = theme.Search.bg.hex,
visual_a_bg = theme.Visual.bg.hex,
replace_a_bg = theme.DiffDelete.bg.hex,
common_fg = specs.Folded.fg.hex,
inactive_bg = specs.StatusLineNC.bg.hex,
inactive_fg = specs.StatusLineNC.fg.hex,
normal_a_bg = specs.PmenuSbar.bg.hex,
normal_b_bg = specs.PmenuSel.bg.hex,
normal_c_bg = specs.StatusLine.bg.hex,
normal_c_fg = specs.StatusLine.fg.hex,
insert_a_bg = specs.DiffText.bg.hex,
command_a_bg = specs.Search.bg.hex,
visual_a_bg = specs.Visual.bg.hex,
replace_a_bg = specs.DiffDelete.bg.hex,
},
}
end

View File

@@ -18,9 +18,10 @@ set -g clock-mode-colour '${color5}'
set -g mode-style fg='${color0}',bg='${selection_background}'
]]
return function(name, theme, palette, term)
return function(name, specs, p)
local term = require("zenbones.term").colors_map(p)
local values = {
selection_background = theme.Visual.bg.hex,
selection_background = specs.Visual.bg.hex,
}
for i, v in ipairs(term) do
values["color" .. (i - 1)] = v.hex

View File

@@ -44,14 +44,15 @@ endif
]]
local lush = require "lush"
return function(name, theme, palette, term)
return function(name, specs, p)
local term = require("zenbones.term").colors_map(p)
local termcolors = ""
for i, v in ipairs(term) 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")
local vimcolors = table.concat(vim.fn.sort(lush.compile(specs, { exclude_keys = { "blend" } })), "\n")
return {
string.format("colors/%s.vim", name),

View File

@@ -13,18 +13,19 @@ ansi = ["${color0}", "${color1}", "${color2}", "${color3}", "${color4}", "${colo
brights = ["${color8}", "${color9}", "${color10}", "${color11}", "${color12}", "${color13}", "${color14}", "${color15}"]
]]
return function(name, theme, palette, term)
return function(name, specs, p)
local term = require("zenbones.term").colors_map(p)
local name = name:sub(1, 1):upper() .. name:sub(2)
local values = {
name = name,
fg = theme.Normal.fg.hex,
bg = theme.Normal.bg.hex,
cursor_bg = theme.Cursor.bg.hex,
cursor_border = theme.Cursor.fg.hex,
cursor_fg = theme.Cursor.fg.hex,
selection_bg = theme.Visual.bg.hex,
selection_fg = theme.Normal.fg.hex,
fg = specs.Normal.fg.hex,
bg = specs.Normal.bg.hex,
cursor_bg = specs.Cursor.bg.hex,
cursor_border = specs.Cursor.fg.hex,
cursor_fg = specs.Cursor.fg.hex,
selection_bg = specs.Visual.bg.hex,
selection_fg = specs.Normal.fg.hex,
}
for i, v in ipairs(term) do
values["color" .. (i - 1)] = v.hex