rename build/ -> template

This commit is contained in:
Michael Chris Lopez
2021-09-21 20:55:53 +08:00
parent 77a82cefca
commit 922eb2de63
23 changed files with 43 additions and 51 deletions

View File

@@ -1,4 +1,4 @@
" This file is auto-generated from lua/zenbones/build/lightline.lua " This file is auto-generated from lua/zenbones/template/lightline.lua
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
let s:p.normal.left = [ [ "#564E4A", "#B2A39B", "bold" ], [ "#564E4A", "#C4B6AF" ] ] let s:p.normal.left = [ [ "#564E4A", "#B2A39B", "bold" ], [ "#564E4A", "#C4B6AF" ] ]

View File

@@ -1,4 +1,4 @@
" This file is auto-generated from lua/zenbones/build/lightline.lua " This file is auto-generated from lua/zenbones/template/lightline.lua
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
let s:p.normal.left = [ [ "#BBAEA8", "#716965", "bold" ], [ "#BBAEA8", "#4E4845" ] ] let s:p.normal.left = [ [ "#BBAEA8", "#716965", "bold" ], [ "#BBAEA8", "#4E4845" ] ]

View File

@@ -1,4 +1,4 @@
" This file is auto-generated from lua/zenbones/build/vim.lua " This file is auto-generated from lua/zenbones/template/vim.lua
if exists('g:colors_name') if exists('g:colors_name')
highlight clear highlight clear
syntax reset syntax reset

View File

@@ -1,4 +1,4 @@
" This file is auto-generated from lua/zenbones/build/vim.lua " This file is auto-generated from lua/zenbones/template/vim.lua
if exists('g:colors_name') if exists('g:colors_name')
highlight clear highlight clear
syntax reset syntax reset

View File

@@ -1,4 +1,4 @@
# This file is auto-generated from lua/zenbones/build/alacritty.lua # This file is auto-generated from lua/zenbones/template/alacritty.lua
# zenbones alacritty colors # zenbones alacritty colors
colors: colors:
# Default colors # Default colors

View File

@@ -1,4 +1,4 @@
# This file is auto-generated from lua/zenbones/build/alacritty.lua # This file is auto-generated from lua/zenbones/template/alacritty.lua
# zenflesh alacritty colors # zenflesh alacritty colors
colors: colors:
# Default colors # Default colors

View File

@@ -1,4 +1,4 @@
# This file is auto-generated from lua/zenbones/build/kitty.lua # This file is auto-generated from lua/zenbones/template/kitty.lua
# vim:ft=kitty # vim:ft=kitty
## name: zenbones ## name: zenbones
## license: MIT ## license: MIT

View File

@@ -1,4 +1,4 @@
# This file is auto-generated from lua/zenbones/build/kitty.lua # This file is auto-generated from lua/zenbones/template/kitty.lua
# vim:ft=kitty # vim:ft=kitty
## name: zenflesh ## name: zenflesh
## license: MIT ## license: MIT

View File

@@ -1,4 +1,4 @@
# This file is auto-generated from lua/zenbones/build/tmux.lua # This file is auto-generated from lua/zenbones/template/tmux.lua
set -g status-left ' #[fg=#88507D,bold]#{s/root//:client_key_table} ' set -g status-left ' #[fg=#88507D,bold]#{s/root//:client_key_table} '
set -g status-right '#[fg=#88507D,bold] [#S]#[fg=#88507D,bold] [%d/%m] #[fg=#88507D,bold][%I:%M%p] ' set -g status-right '#[fg=#88507D,bold] [#S]#[fg=#88507D,bold] [%d/%m] #[fg=#88507D,bold][%I:%M%p] '
set -g status-style fg='#88507D',bg='#2C363C' set -g status-style fg='#88507D',bg='#2C363C'

View File

@@ -1,4 +1,4 @@
# This file is auto-generated from lua/zenbones/build/tmux.lua # This file is auto-generated from lua/zenbones/template/tmux.lua
set -g status-left ' #[fg=#B279A7,bold]#{s/root//:client_key_table} ' set -g status-left ' #[fg=#B279A7,bold]#{s/root//:client_key_table} '
set -g status-right '#[fg=#B279A7,bold] [#S]#[fg=#B279A7,bold] [%d/%m] #[fg=#B279A7,bold][%I:%M%p] ' set -g status-right '#[fg=#B279A7,bold] [#S]#[fg=#B279A7,bold] [%d/%m] #[fg=#B279A7,bold][%I:%M%p] '
set -g status-style fg='#B279A7',bg='#B4BDC3' set -g status-style fg='#B279A7',bg='#B4BDC3'

View File

@@ -1,4 +1,4 @@
# This file is auto-generated from lua/zenbones/build/wezterm.lua # This file is auto-generated from lua/zenbones/template/wezterm.lua
# Zenbones # Zenbones
[colors] [colors]
foreground = "#2C363C" foreground = "#2C363C"

View File

@@ -1,4 +1,4 @@
# This file is auto-generated from lua/zenbones/build/wezterm.lua # This file is auto-generated from lua/zenbones/template/wezterm.lua
# Zenflesh # Zenflesh
[colors] [colors]
foreground = "#B4BDC3" foreground = "#B4BDC3"

View File

@@ -1,4 +1,4 @@
-- This file is auto-generated from lua/zenbones/build/lualine.lua -- This file is auto-generated from lua/zenbones/template/lualine.lua
local common_fg = "#564E4A" local common_fg = "#564E4A"
local inactive_bg = "#DAD3CF" local inactive_bg = "#DAD3CF"
local inactive_fg = "#596A76" local inactive_fg = "#596A76"

View File

@@ -1,4 +1,4 @@
-- This file is auto-generated from lua/zenbones/build/lualine.lua -- This file is auto-generated from lua/zenbones/template/lualine.lua
local common_fg = "#BBAEA8" local common_fg = "#BBAEA8"
local inactive_bg = "#312D2B" local inactive_bg = "#312D2B"
local inactive_fg = "#CAD0D4" local inactive_fg = "#CAD0D4"

View File

@@ -1,36 +1,10 @@
local util = require "zenbones.util" 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() local function build()
local templates = { "vim", "kitty", "alacritty", "wezterm", "lualine", "lightline", "tmux" } local templates = { "vim", "kitty", "alacritty", "wezterm", "lualine", "lightline", "tmux" }
for _, t in ipairs(templates) do for _, t in ipairs(templates) do
write_template( util.build("zenbones", require "zenbones", require "zenbones.palette", require "zenbones.terminal")
unpack( util.build("zenflesh", require "zenflesh", require "zenflesh.palette", require "zenflesh.terminal")
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
end end

View File

@@ -1,4 +1,4 @@
local template = [[# This file is auto-generated from lua/zenbones/build/alacritty.lua local template = [[# This file is auto-generated from lua/zenbones/template/alacritty.lua
# ${name} alacritty colors # ${name} alacritty colors
colors: colors:
# Default colors # Default colors

View File

@@ -1,4 +1,4 @@
local template = [[# This file is auto-generated from lua/zenbones/build/kitty.lua local template = [[# This file is auto-generated from lua/zenbones/template/kitty.lua
# vim:ft=kitty # vim:ft=kitty
## name: ${name} ## name: ${name}
## license: MIT ## license: MIT

View File

@@ -1,4 +1,4 @@
local template = [[" This file is auto-generated from lua/zenbones/build/lightline.lua 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': {}, '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.left = [ [ "${common_fg}", "${normal_a_bg}", "bold" ], [ "${common_fg}", "${normal_b_bg}" ] ]

View File

@@ -1,4 +1,4 @@
local template = [[-- This file is auto-generated from lua/zenbones/build/lualine.lua local template = [[-- This file is auto-generated from lua/zenbones/template/lualine.lua
local common_fg = "${common_fg}" local common_fg = "${common_fg}"
local inactive_bg = "${inactive_bg}" local inactive_bg = "${inactive_bg}"
local inactive_fg = "${inactive_fg}" local inactive_fg = "${inactive_fg}"

View File

@@ -1,4 +1,4 @@
local template = [[# This file is auto-generated from lua/zenbones/build/tmux.lua 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-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-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 status-style fg='${color5}',bg='${color7}'

View File

@@ -1,6 +1,4 @@
local lush = require "lush" local template = [[" This file is auto-generated from lua/zenbones/template/vim.lua
local template = [[" This file is auto-generated from lua/zenbones/build/vim.lua
if exists('g:colors_name') if exists('g:colors_name')
highlight clear highlight clear
syntax reset syntax reset
@@ -35,6 +33,7 @@ endif
${vimcolors} ${vimcolors}
]] ]]
local lush = require "lush"
return function(name, theme, palette, terminal) return function(name, theme, palette, terminal)
local termcolors = "" local termcolors = ""
for i, v in ipairs(terminal.colors) do for i, v in ipairs(terminal.colors) do

View File

@@ -1,4 +1,4 @@
local template = [[# This file is auto-generated from lua/zenbones/build/wezterm.lua local template = [[# This file is auto-generated from lua/zenbones/template/wezterm.lua
# ${name} # ${name}
[colors] [colors]
foreground = "${fg}" foreground = "${fg}"

View File

@@ -7,4 +7,23 @@ function M.interp(s, tab)
end)) end))
end end
function M.bg_to_base_name()
return vim.opt.background:get() == "light" and "zenbones" or "zenflesh"
end
local function write_template(path, template, values)
print("[write template] " .. path)
local content = M.interp(template, values)
local file = io.open(path, "w")
file:write(content)
file:close()
end
function M.build(name, specs, palette, terminal)
local templates = { "vim", "kitty", "alacritty", "wezterm", "lualine", "lightline", "tmux" }
for _, t in ipairs(templates) do
write_template(unpack(require("zenbones.template." .. t)(name, specs, palette, terminal)))
end
end
return M return M