From 8e9a4cbd919dd861caf2c1d906b24a5efba10f82 Mon Sep 17 00:00:00 2001 From: Michael Chris Lopez Date: Sun, 10 Oct 2021 13:43:40 +0800 Subject: [PATCH] update build to derive term colors --- extras/alacritty/neobones_light.yml | 2 +- extras/iterm/neobones_light.itermcolors | 4 +-- extras/kitty/neobones_light.conf | 2 +- extras/wezterm/Neobones_light.toml | 2 +- lua/zenbones/build.lua | 32 +++++-------------- lua/zenbones/template/alacritty.lua | 7 +++-- lua/zenbones/template/iterm.lua | 21 +++++++------ lua/zenbones/template/kitty.lua | 13 ++++---- lua/zenbones/template/lightline.lua | 42 ++++++++++++------------- lua/zenbones/template/lualine.lua | 24 +++++++------- lua/zenbones/template/tmux.lua | 5 +-- lua/zenbones/template/vim.lua | 5 +-- lua/zenbones/template/wezterm.lua | 17 +++++----- 13 files changed, 83 insertions(+), 93 deletions(-) diff --git a/extras/alacritty/neobones_light.yml b/extras/alacritty/neobones_light.yml index 16f6e79..77938ac 100644 --- a/extras/alacritty/neobones_light.yml +++ b/extras/alacritty/neobones_light.yml @@ -19,7 +19,7 @@ colors: bright: black: '#B3C6B6' red: '#94253E' - green: '#466522' + green: '#3F5A22' yellow: '#803D1C' blue: '#1D5573' magenta: '#7B3B70' diff --git a/extras/iterm/neobones_light.itermcolors b/extras/iterm/neobones_light.itermcolors index 72642c8..2c68ab3 100644 --- a/extras/iterm/neobones_light.itermcolors +++ b/extras/iterm/neobones_light.itermcolors @@ -37,9 +37,9 @@ Color Space sRGB Green Component - 0.3960784313725490 + 0.3529411764705883 Red Component - 0.2745098039215687 + 0.2470588235294118 Ansi 11 Color diff --git a/extras/kitty/neobones_light.conf b/extras/kitty/neobones_light.conf index 7d6891d..efd4e7c 100644 --- a/extras/kitty/neobones_light.conf +++ b/extras/kitty/neobones_light.conf @@ -32,7 +32,7 @@ color7 #202E18 # bright color8 #B3C6B6 color9 #94253E -color10 #466522 +color10 #3F5A22 color11 #803D1C color12 #1D5573 color13 #7B3B70 diff --git a/extras/wezterm/Neobones_light.toml b/extras/wezterm/Neobones_light.toml index 874f71f..b4d6e73 100644 --- a/extras/wezterm/Neobones_light.toml +++ b/extras/wezterm/Neobones_light.toml @@ -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"] diff --git a/lua/zenbones/build.lua b/lua/zenbones/build.lua index decae40..05f3f4a 100644 --- a/lua/zenbones/build.lua +++ b/lua/zenbones/build.lua @@ -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 diff --git a/lua/zenbones/template/alacritty.lua b/lua/zenbones/template/alacritty.lua index 4bc1652..9de39bc 100644 --- a/lua/zenbones/template/alacritty.lua +++ b/lua/zenbones/template/alacritty.lua @@ -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 diff --git a/lua/zenbones/template/iterm.lua b/lua/zenbones/template/iterm.lua index dbf1a47..6b80cd2 100644 --- a/lua/zenbones/template/iterm.lua +++ b/lua/zenbones/template/iterm.lua @@ -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 diff --git a/lua/zenbones/template/kitty.lua b/lua/zenbones/template/kitty.lua index 9ecc065..a55cd50 100644 --- a/lua/zenbones/template/kitty.lua +++ b/lua/zenbones/template/kitty.lua @@ -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 diff --git a/lua/zenbones/template/lightline.lua b/lua/zenbones/template/lightline.lua index a178ed4..a1085b2 100644 --- a/lua/zenbones/template/lightline.lua +++ b/lua/zenbones/template/lightline.lua @@ -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 diff --git a/lua/zenbones/template/lualine.lua b/lua/zenbones/template/lualine.lua index 3e1a073..3c366f8 100644 --- a/lua/zenbones/template/lualine.lua +++ b/lua/zenbones/template/lualine.lua @@ -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 diff --git a/lua/zenbones/template/tmux.lua b/lua/zenbones/template/tmux.lua index 9f82975..114cebe 100644 --- a/lua/zenbones/template/tmux.lua +++ b/lua/zenbones/template/tmux.lua @@ -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 diff --git a/lua/zenbones/template/vim.lua b/lua/zenbones/template/vim.lua index c927c6f..c8728b8 100644 --- a/lua/zenbones/template/vim.lua +++ b/lua/zenbones/template/vim.lua @@ -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), diff --git a/lua/zenbones/template/wezterm.lua b/lua/zenbones/template/wezterm.lua index f9a1c1b..76b74a9 100644 --- a/lua/zenbones/template/wezterm.lua +++ b/lua/zenbones/template/wezterm.lua @@ -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