From 8185f46dcd79bf75a7ed8c35706c53c49d39f9a3 Mon Sep 17 00:00:00 2001 From: Michael Chris Lopez Date: Sat, 6 Nov 2021 11:49:28 +0800 Subject: [PATCH] remove old build system --- lua/zenbones/build.lua | 261 ---------------------------- lua/zenbones/template/alacritty.lua | 42 ----- lua/zenbones/template/iterm.lua | 89 ---------- lua/zenbones/template/kitty.lua | 65 ------- lua/zenbones/template/lightline.lua | 53 ------ lua/zenbones/template/lualine.lua | 55 ------ lua/zenbones/template/tmux.lua | 31 ---- lua/zenbones/template/vim.lua | 58 ------- lua/zenbones/template/wezterm.lua | 34 ---- 9 files changed, 688 deletions(-) delete mode 100644 lua/zenbones/build.lua delete mode 100644 lua/zenbones/template/alacritty.lua delete mode 100644 lua/zenbones/template/iterm.lua delete mode 100644 lua/zenbones/template/kitty.lua delete mode 100644 lua/zenbones/template/lightline.lua delete mode 100644 lua/zenbones/template/lualine.lua delete mode 100644 lua/zenbones/template/tmux.lua delete mode 100644 lua/zenbones/template/vim.lua delete mode 100644 lua/zenbones/template/wezterm.lua diff --git a/lua/zenbones/build.lua b/lua/zenbones/build.lua deleted file mode 100644 index a4919b3..0000000 --- a/lua/zenbones/build.lua +++ /dev/null @@ -1,261 +0,0 @@ -local util = require "zenbones.util" - -local function write_template(path, template, values) - print("[write template] " .. path) - local content = util.interp(template, values) - local file = io.open(path, "w") - file:write(content) - file:close() -end - -local function build(name, specs, palette, opt) - local exclude = opt.exclude or {} - local template_opt = opt.template_opt or {} - local template_keys = { "vim", "iterm", "kitty", "alacritty", "wezterm", "lualine", "lightline", "tmux" } - for _, key in ipairs(template_keys) do - if not vim.tbl_contains(exclude, key) then - local template = require("zenbones.template." .. key) - write_template(unpack(template(name, specs, palette, template_opt[key] or {}))) - end - end -end - -local config_set = { - { - name = "zenbones_light", - specs = "zenbones", - palette = require("zenbones.palette").light, - setup = function() - vim.opt.background = "light" - end, - }, - - { - name = "zenbones_dark", - specs = "zenbones", - palette = require("zenbones.palette").dark, - setup = function() - vim.opt.background = "dark" - end, - }, - - { - name = "zenbones_bright", - specs = "zenbones", - palette = require("zenbones.palette").light, - setup = function() - vim.g.zenbones_lightness = "bright" - end, - cleanup = function() - vim.api.nvim_del_var "zenbones_lightness" - end, - opt = { - exclude = { "vim", "lightline", "lualine" }, - }, - }, - - { - name = "zenbones_dim", - specs = "zenbones", - palette = require("zenbones.palette").light, - setup = function() - vim.g.zenbones_lightness = "dim" - end, - cleanup = function() - vim.api.nvim_del_var "zenbones_lightness" - end, - opt = { - exclude = { "vim", "lightline", "lualine" }, - }, - }, - - -- { - -- name = "zenflesh_stark", - -- specs = "zenflesh", - -- palette = require "zenflesh.palette", - -- setup = function() - -- vim.g.zenflesh_darkness = "stark" - -- end, - -- cleanup = function() - -- vim.api.nvim_del_var "zenflesh_darkness" - -- end, - -- opt = { - -- exclude = { "vim", "lightline", "lualine" }, - -- }, - -- }, - -- - -- { - -- name = "zenflesh_warm", - -- specs = "zenflesh", - -- palette = require "zenflesh.palette", - -- setup = function() - -- vim.g.zenflesh_darkness = "warm" - -- end, - -- cleanup = function() - -- vim.api.nvim_del_var "zenflesh_darkness" - -- end, - -- opt = { - -- exclude = { "vim", "lightline", "lualine" }, - -- }, - -- }, - - { - name = "neobones_light", - specs = "neobones", - palette = require("neobones.palette").light, - setup = function() - vim.opt.background = "light" - end, - opt = { - exclude = { "vim" }, - }, - }, - - { - name = "neobones_dark", - specs = "neobones", - palette = require("neobones.palette").dark, - setup = function() - vim.opt.background = "dark" - end, - opt = { - exclude = { "vim" }, - }, - }, - - { - name = "zenwritten_light", - specs = "zenwritten", - palette = require("zenwritten.palette").light, - setup = function() - vim.opt.background = "light" - end, - opt = { - exclude = { "vim" }, - }, - }, - - { - name = "zenwritten_dark", - specs = "zenwritten", - palette = require("zenwritten.palette").dark, - setup = function() - vim.opt.background = "dark" - end, - opt = { - exclude = { "vim" }, - }, - }, - - { - name = "rosebones_light", - specs = "rosebones", - palette = require("rosebones.palette").light, - setup = function() - vim.opt.background = "light" - end, - opt = { - exclude = { "vim", "alacritty", "iterm", "kitty", "tmux", "wezterm" }, - }, - }, - - { - name = "rosebones_dark", - specs = "rosebones", - palette = require("rosebones.palette").dark, - setup = function() - vim.opt.background = "dark" - end, - opt = { - exclude = { "vim", "alacritty", "iterm", "kitty", "tmux", "wezterm" }, - }, - }, - - { - name = "forestbones_light", - specs = "forestbones", - palette = require("forestbones.palette").light, - setup = function() - vim.opt.background = "light" - end, - opt = { - exclude = { "vim", "alacritty", "iterm", "kitty", "tmux", "wezterm" }, - }, - }, - - { - name = "forestbones_dark", - specs = "forestbones", - palette = require("forestbones.palette").dark, - setup = function() - vim.opt.background = "dark" - end, - opt = { - exclude = { "vim", "alacritty", "iterm", "kitty", "tmux", "wezterm" }, - }, - }, - - { - name = "tokyobones_light", - specs = "tokyobones", - palette = require("tokyobones.palette").light, - setup = function() - vim.opt.background = "light" - end, - opt = { - exclude = { "vim", "alacritty", "iterm", "kitty", "tmux", "wezterm" }, - }, - }, - - { - name = "tokyobones_dark", - specs = "tokyobones", - palette = require("tokyobones.palette").dark, - setup = function() - vim.opt.background = "dark" - end, - opt = { - exclude = { "vim", "alacritty", "iterm", "kitty", "tmux", "wezterm" }, - }, - }, - - { - name = "nordbones", - palette = require("nordbones.palette").dark, - opt = { - exclude = { "alacritty", "iterm", "kitty", "tmux", "wezterm" }, - }, - }, - - { - name = "vimbones", - palette = require "vimbones.palette", - opt = { - template_opt = { - vim = { bg = "light" }, - }, - }, - }, -} - -local function build_from(config) - if config.setup then - config.setup() - end - local specs = config.specs or config.name - package.loaded[specs] = nil - build(config.name, require(specs), config.palette, config.opt or {}) - if config.cleanup then - config.cleanup() - end -end - -local M = {} - -function M.run() - for _i, config in ipairs(config_set) do - build_from(config) - end -end - -return M diff --git a/lua/zenbones/template/alacritty.lua b/lua/zenbones/template/alacritty.lua deleted file mode 100644 index 9de39bc..0000000 --- a/lua/zenbones/template/alacritty.lua +++ /dev/null @@ -1,42 +0,0 @@ -local template = [[# This file is auto-generated from lua/zenbones/template/alacritty.lua -# ${name} alacritty colors -colors: - # Default colors - primary: - background: '${bg}' - foreground: '${fg}' - # Normal colors - normal: - black: '${color0}' - red: '${color1}' - green: '${color2}' - yellow: '${color3}' - blue: '${color4}' - magenta: '${color5}' - cyan: '${color6}' - white: '${color7}' - # Bright colors - bright: - black: '${color8}' - red: '${color9}' - green: '${color10}' - yellow: '${color11}' - blue: '${color12}' - magenta: '${color13}' - cyan: '${color14}' - white: '${color15}' -]] - -return function(name, specs, p) - local term = require("zenbones.term").colors_map(p) - local values = { - name = name, - bg = specs.Normal.bg.hex, - fg = specs.Normal.fg.hex, - } - for i, v in ipairs(term) do - values["color" .. (i - 1)] = v.hex - end - - return { string.format("extras/alacritty/%s.yml", name), template, values } -end diff --git a/lua/zenbones/template/iterm.lua b/lua/zenbones/template/iterm.lua deleted file mode 100644 index 853fa98..0000000 --- a/lua/zenbones/template/iterm.lua +++ /dev/null @@ -1,89 +0,0 @@ -local util = require "zenbones.util" - -local key_template = [[ - ${k} Color -]] -local color_template = [[ - - Alpha Component - 1 - Blue Component - ${b} - Color Space - sRGB - Green Component - ${g} - Red Component - ${r} - ]] - -local start_template = [[ - - - -]] -local end_template = [[ - - -]] - -local function hex_to_rgb(hex) - local _, r, g, b = hex:match "(.)(..)(..)(..)" - r, g, b = - string.format("%0.16f", (tonumber(r, 16) / 255)), - string.format("%0.16f", (tonumber(g, 16) / 255)), - string.format("%0.16f", (tonumber(b, 16) / 255)) - return { r = r, g = g, b = b } -end - -local function key_to_xml(key, color) - local xml = util.interp(key_template, { k = key }) - local rgb = hex_to_rgb(color.hex) - xml = xml .. util.interp(color_template, rgb) - return xml -end - -return function(name, specs, p) - local term = require("zenbones.term").colors_map(p) - local colors = { - ["Ansi 0"] = term[1], - ["Ansi 1"] = term[2], - ["Ansi 2"] = term[3], - ["Ansi 3"] = term[4], - ["Ansi 4"] = term[5], - ["Ansi 5"] = term[6], - ["Ansi 6"] = term[7], - ["Ansi 7"] = term[8], - ["Ansi 8"] = term[9], - ["Ansi 9"] = term[10], - ["Ansi 10"] = term[11], - ["Ansi 11"] = term[12], - ["Ansi 12"] = term[13], - ["Ansi 13"] = term[14], - ["Ansi 14"] = term[15], - ["Ansi 15"] = term[16], - Foreground = specs.Normal.fg, - Background = specs.Normal.bg, - Bold = term[9], - Cursor = specs.Cursor.bg, - ["Cursor Text"] = specs.Cursor.fg, - ["Cursor Guide"] = specs.CursorLine.bg, - Link = term[13], - Selection = specs.Visual.bg, - ["Selected Text"] = specs.Normal.fg, - Badge = specs.Comment.fg, - Tab = specs.Normal.bg, - } - - local template = start_template - - local xml_compiled = {} - for k, c in pairs(colors) do - table.insert(xml_compiled, key_to_xml(k, c)) - end - - template = template .. table.concat(vim.fn.sort(xml_compiled), "\n") - template = template .. end_template - - return { string.format("extras/iterm/%s.itermcolors", name), template, {} } -end diff --git a/lua/zenbones/template/kitty.lua b/lua/zenbones/template/kitty.lua deleted file mode 100644 index a55cd50..0000000 --- a/lua/zenbones/template/kitty.lua +++ /dev/null @@ -1,65 +0,0 @@ -local template = [[# This file is auto-generated from lua/zenbones/template/kitty.lua -# vim:ft=kitty -## name: ${name} -## license: MIT -## author: Michael Chris Lopez -## upstream: https://github.com/mcchrish/zenbones.nvim/raw/main/extras/kitty/${name}.conf - -background ${background} -foreground ${foreground} -selection_background ${selection_background} -selection_foreground ${selection_foreground} -url_color ${url_color} -cursor ${cursor} - -# Tabs -active_tab_background ${active_tab_background} -active_tab_foreground ${active_tab_foreground} -inactive_tab_background ${inactive_tab_background} -inactive_tab_foreground ${inactive_tab_foreground} -#tab_bar_background ${tab_bar_background} - -# normal -color0 ${color0} -color1 ${color1} -color2 ${color2} -color3 ${color3} -color4 ${color4} -color5 ${color5} -color6 ${color6} -color7 ${color7} - -# bright -color8 ${color8} -color9 ${color9} -color10 ${color10} -color11 ${color11} -color12 ${color12} -color13 ${color13} -color14 ${color14} -color15 ${color15} -]] - -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 = specs.Visual.bg.hex, - selection_foreground = fg, - url_color = term[13].hex, - cursor = fg, - active_tab_background = specs.Search.bg.hex, - active_tab_foreground = fg, - inactive_tab_background = specs.StatusLine.bg.hex, - inactive_tab_foreground = fg, - } - for i, v in ipairs(term) do - values["color" .. (i - 1)] = v.hex - end - - return { string.format("extras/kitty/%s.conf", name), template, values } -end diff --git a/lua/zenbones/template/lightline.lua b/lua/zenbones/template/lightline.lua deleted file mode 100644 index a0e81d2..0000000 --- a/lua/zenbones/template/lightline.lua +++ /dev/null @@ -1,53 +0,0 @@ -local template = [[" This file is auto-generated from lua/zenbones/template/lightline.lua -let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} - -let s:p.normal.left = [ [ "${common_fg}", "${normal_a_bg}", "bold" ], [ "${common_fg}", "${normal_b_bg}" ] ] -let s:p.normal.middle = [ [ "${normal_c_fg}", "${normal_c_bg}" ] ] -let s:p.normal.right = [ [ "${common_fg}", "${normal_b_bg}" ], [ "${common_fg}", "${normal_b_bg}" ] ] -let s:p.normal.warning = [ [ "${warning_fg}", "${warning_bg}" ] ] -let s:p.normal.error = [ [ "${error_fg}", "${error_bg}" ] ] - -let s:p.inactive.left = [ [ "${inactive_fg}", "${inactive_bg}" ], [ "${inactive_fg}", "${inactive_bg}" ] ] -let s:p.inactive.middle = [ [ "${inactive_fg}", "${inactive_bg}" ] ] -let s:p.inactive.right = [ [ "${inactive_fg}", "${inactive_bg}" ] ] - -let s:p.insert.left = [ [ "${common_fg}", "${insert_a_bg}", "bold" ], [ "${common_fg}", "${normal_b_bg}" ] ] -let s:p.replace.left = [ [ "${common_fg}", "${replace_a_bg}", "bold" ], [ "${common_fg}", "${normal_b_bg}" ] ] -let s:p.visual.left = [ [ "${common_fg}", "${visual_a_bg}", "bold" ], [ "${common_fg}", "${normal_b_bg}" ] ] - -let s:p.tabline.left = [ [ "${tabline_left_fg}", "${tabline_left_bg}", "italic" ] ] -let s:p.tabline.middle = [ [ "${inactive_fg}", "${inactive_bg}" ] ] -let s:p.tabline.right = [ [ "${tabline_right_fg}", "${tabline_right_bg}" ] ] -let s:p.tabline.tabsel = [ [ "${tabsel_fg}", "${tabsel_bg}", "bold" ] ] - -let g:lightline#colorscheme#zenbones#palette = lightline#colorscheme#fill(s:p) -]] - -return function(name, specs) - return { - string.format("autoload/lightline/colorscheme/%s.vim", name), - template, - { - 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.DiagnosticVirtualTextError.bg.hex, - error_fg = specs.DiagnosticVirtualTextError.fg.hex, - }, - } -end diff --git a/lua/zenbones/template/lualine.lua b/lua/zenbones/template/lualine.lua deleted file mode 100644 index ba45f17..0000000 --- a/lua/zenbones/template/lualine.lua +++ /dev/null @@ -1,55 +0,0 @@ -local template = [[-- This file is auto-generated from lua/zenbones/template/lualine.lua -local common_fg = "${common_fg}" -local inactive_bg = "${inactive_bg}" -local inactive_fg = "${inactive_fg}" - -return { - normal = { - a = { bg = "${normal_a_bg}", fg = common_fg, gui = "bold" }, - b = { bg = "${normal_b_bg}", fg = common_fg }, - c = { bg = "${normal_c_bg}", fg = "${normal_c_fg}" }, - }, - - insert = { - a = { bg = "${insert_a_bg}", fg = common_fg, gui = "bold" }, - }, - - command = { - a = { bg = "${command_a_bg}", fg = common_fg, gui = "bold" }, - }, - - visual = { - a = { bg = "${visual_a_bg}", fg = common_fg, gui = "bold" }, - }, - - replace = { - a = { bg = "${replace_a_bg}", fg = common_fg, gui = "bold" }, - }, - - inactive = { - a = { bg = inactive_bg, fg = inactive_fg, gui = "bold" }, - b = { bg = inactive_bg, fg = inactive_fg }, - c = { bg = inactive_bg, fg = inactive_fg }, - }, -} -]] - -return function(name, specs) - return { - string.format("lua/lualine/themes/%s.lua", name), - template, - { - 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 deleted file mode 100644 index 114cebe..0000000 --- a/lua/zenbones/template/tmux.lua +++ /dev/null @@ -1,31 +0,0 @@ -local template = [[# This file is auto-generated from lua/zenbones/template/tmux.lua -set -g status-left ' #[fg=${color5},bold]#{s/root//:client_key_table} ' -set -g status-right '#[fg=${color5},bold] [#S]#[fg=${color5},bold] [%d/%m] #[fg=${color5},bold][%I:%M%p] ' -set -g status-style fg='${color5}',bg='${color7}' - -set -g window-status-current-style fg='${color5}',bg='${color7}',bold - -set -g pane-border-style fg='${color5}' -set -g pane-active-border-style fg='${color5}' - -set -g message-style fg='${color0}',bg='${selection_background}' - -set -g display-panes-active-colour '${color5}' -set -g display-panes-colour '${color5}' - -set -g clock-mode-colour '${color5}' - -set -g mode-style fg='${color0}',bg='${selection_background}' -]] - -return function(name, specs, p) - local term = require("zenbones.term").colors_map(p) - local values = { - selection_background = specs.Visual.bg.hex, - } - for i, v in ipairs(term) do - values["color" .. (i - 1)] = v.hex - end - - return { string.format("extras/tmux/%s.tmux", name), template, values } -end diff --git a/lua/zenbones/template/vim.lua b/lua/zenbones/template/vim.lua deleted file mode 100644 index 6d2a99e..0000000 --- a/lua/zenbones/template/vim.lua +++ /dev/null @@ -1,58 +0,0 @@ -local template = [[" This file is auto-generated from lua/zenbones/template/vim.lua -function! ${name}#load() - -${termcolors} -${vimcolors} -highlight! link StatusLineTerm StatusLine -highlight! link StatusLineTermNC StatusLineNC - -if has('terminal') - let g:terminal_ansi_colors = [ - \ g:terminal_color_0, - \ g:terminal_color_1, - \ g:terminal_color_2, - \ g:terminal_color_3, - \ g:terminal_color_4, - \ g:terminal_color_5, - \ g:terminal_color_6, - \ g:terminal_color_7, - \ g:terminal_color_8, - \ g:terminal_color_9, - \ g:terminal_color_10, - \ g:terminal_color_11, - \ g:terminal_color_12, - \ g:terminal_color_13, - \ g:terminal_color_14, - \ g:terminal_color_15 - \ ] -endif - -endfunction -]] - -return function(name, specs, p) - local lush = require "lush" - 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 compiled = lush.compile(specs, { - exclude_keys = { "blend" }, - copy_cterm_from_gui = true, - }) - local vimcolors = table.concat(vim.fn.sort(compiled), "\n") - - return { - string.format("autoload/%s.vim", name), - template, - { - name = name, - specs_path = name, - termcolors = termcolors, - vimcolors = vimcolors, - }, - } -end diff --git a/lua/zenbones/template/wezterm.lua b/lua/zenbones/template/wezterm.lua deleted file mode 100644 index 98ba12a..0000000 --- a/lua/zenbones/template/wezterm.lua +++ /dev/null @@ -1,34 +0,0 @@ -local template = [[# This file is auto-generated from lua/zenbones/template/wezterm.lua -# ${name} -[colors] -foreground = "${fg}" -background = "${bg}" -cursor_bg = "${cursor_bg}" -cursor_border = "${cursor_border}" -cursor_fg = "${cursor_fg}" -selection_bg = "${selection_bg}" -selection_fg = "${selection_fg}" - -ansi = ["${color0}", "${color1}", "${color2}", "${color3}", "${color4}", "${color5}", "${color6}", "${color7}"] -brights = ["${color8}", "${color9}", "${color10}", "${color11}", "${color12}", "${color13}", "${color14}", "${color15}"] -]] - -return function(name, specs, p) - local term = require("zenbones.term").colors_map(p) - - local values = { - name = name:sub(1, 1):upper() .. name:sub(2), - 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 - end - - return { string.format("extras/wezterm/%s.toml", values.name), template, values } -end