diff --git a/lua/zenbones/build.lua b/lua/zenbones/build.lua index 825bdfd..749390d 100644 --- a/lua/zenbones/build.lua +++ b/lua/zenbones/build.lua @@ -1,6 +1,3 @@ -local theme = require "zenbones" -local terminal = require "zenbones.terminal" - -- got from http://lua-users.org/wiki/StringInterpolation function interp(s, tab) return (s:gsub("($%b{})", function(w) @@ -19,7 +16,8 @@ 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))) + write_template(unpack(require("zenbones.build." .. t) "zenbones")) + write_template(unpack(require("zenbones.build." .. t) "zenflesh")) end end diff --git a/lua/zenbones/build/alacritty.lua b/lua/zenbones/build/alacritty.lua index 1a0d92f..3037bc5 100644 --- a/lua/zenbones/build/alacritty.lua +++ b/lua/zenbones/build/alacritty.lua @@ -1,4 +1,4 @@ -local template = [[# Zenbones Alacritty Colors +local template = [[# ${name} alacritty colors colors: # Default colors primary: @@ -26,15 +26,18 @@ colors: white: '${color15}' ]] -local theme = require "zenbones" -local terminal = require "zenbones.terminal" +return function(name) + local theme = require(name) + local terminal = require(name .. ".terminal") -local values = { - bg = theme.Normal.bg.hex, - fg = theme.Normal.fg.hex, -} -for i, v in ipairs(terminal.colors) do - values["color" .. (i - 1)] = v.hex + local values = { + name = name, + bg = theme.Normal.bg.hex, + fg = theme.Normal.fg.hex, + } + for i, v in ipairs(terminal.colors) do + values["color" .. (i - 1)] = v.hex + end + + return { string.format("extras/alacritty/%s.yml", name), template, values } end - -return { "extras/alacritty/zenbones.yml", template, values } diff --git a/lua/zenbones/build/kitty.lua b/lua/zenbones/build/kitty.lua index b7da423..6e31674 100644 --- a/lua/zenbones/build/kitty.lua +++ b/lua/zenbones/build/kitty.lua @@ -1,8 +1,8 @@ local template = [[# vim:ft=kitty -## name: zenbones +## name: ${name} ## license: MIT ## author: Michael Chris Lopez -## upstream: https://github.com/mcchrish/zenbones.nvim/raw/main/extras/kitty/zenbones.conf +## upstream: https://github.com/mcchrish/zenbones.nvim/raw/main/extras/kitty/${name}.conf background ${background} foreground ${foreground} @@ -39,25 +39,28 @@ color14 ${color14} color15 ${color15} ]] -local theme = require "zenbones" -local terminal = require "zenbones.terminal" +return function(name) + local theme = require(name) + local terminal = require(name .. ".terminal") -local bg = theme.Normal.bg.hex -local fg = theme.Normal.fg.hex -local values = { - background = bg, - foreground = fg, - selection_background = theme.Visual.bg.hex, - selection_foreground = fg, - url_color = terminal.colors[14].hex, - cursor = fg, - active_tab_background = theme.Search.bg.hex, - active_tab_foreground = fg, - inactive_tab_background = theme.StatusLine.bg.hex, - inactive_tab_foreground = fg, -} -for i, v in ipairs(terminal.colors) do - values["color" .. (i - 1)] = v.hex + local bg = theme.Normal.bg.hex + local fg = theme.Normal.fg.hex + local values = { + name = name, + background = bg, + foreground = fg, + selection_background = theme.Visual.bg.hex, + selection_foreground = fg, + url_color = terminal.colors[14].hex, + cursor = fg, + active_tab_background = theme.Search.bg.hex, + active_tab_foreground = fg, + inactive_tab_background = theme.StatusLine.bg.hex, + inactive_tab_foreground = fg, + } + for i, v in ipairs(terminal.colors) do + values["color" .. (i - 1)] = v.hex + end + + return { string.format("extras/kitty/%s.conf", name), template, values } end - -return { "extras/kitty/zenbones.conf", template, values } diff --git a/lua/zenbones/build/lightline.lua b/lua/zenbones/build/lightline.lua index 89a0d84..f820515 100644 --- a/lua/zenbones/build/lightline.lua +++ b/lua/zenbones/build/lightline.lua @@ -22,31 +22,33 @@ let s:p.tabline.tabsel = [ [ "${tabsel_fg}", "${tabsel_bg}", "bold" ] ] let g:lightline#colorscheme#zenbones#palette = lightline#colorscheme#fill(s:p) ]] -local theme = require "zenbones" +return function(name) + local theme = require(name) -return { - "autoload/lightline/colorscheme/zenbones.vim", - 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.DiffAdd.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.LspDiagnosticsVirtualTextWarning.bg.hex, - warning_fg = theme.LspDiagnosticsVirtualTextWarning.fg.hex, - error_bg = theme.LspDiagnosticsVirtualTextError.bg.hex, - error_fg = theme.LspDiagnosticsVirtualTextError.fg.hex, - }, -} + 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.DiffAdd.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.LspDiagnosticsVirtualTextWarning.bg.hex, + warning_fg = theme.LspDiagnosticsVirtualTextWarning.fg.hex, + error_bg = theme.LspDiagnosticsVirtualTextError.bg.hex, + error_fg = theme.LspDiagnosticsVirtualTextError.fg.hex, + }, + } +end diff --git a/lua/zenbones/build/lualine.lua b/lua/zenbones/build/lualine.lua index 8e2aa7f..7d20559 100644 --- a/lua/zenbones/build/lualine.lua +++ b/lua/zenbones/build/lualine.lua @@ -33,22 +33,24 @@ return { } ]] -local theme = require "zenbones" +return function(name) + local theme = require(name) -return { - "lua/lualine/themes/zenbones.lua", - 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.DiffAdd.bg.hex, - command_a_bg = theme.Search.bg.hex, - visual_a_bg = theme.Visual.bg.hex, - replace_a_bg = theme.DiffDelete.bg.hex, - }, -} + 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.DiffAdd.bg.hex, + command_a_bg = theme.Search.bg.hex, + visual_a_bg = theme.Visual.bg.hex, + replace_a_bg = theme.DiffDelete.bg.hex, + }, + } +end diff --git a/lua/zenbones/build/tmux.lua b/lua/zenbones/build/tmux.lua index f16b703..5374ce7 100644 --- a/lua/zenbones/build/tmux.lua +++ b/lua/zenbones/build/tmux.lua @@ -17,14 +17,16 @@ set -g clock-mode-colour '${color5}' set -g mode-style fg='${color0}',bg='${selection_background}' ]] -local theme = require "zenbones" -local terminal = require "zenbones.terminal" +return function(name) + local theme = require(name) + local terminal = require(name .. ".terminal") -local values = { - selection_background = theme.Visual.bg.hex, -} -for i, v in ipairs(terminal.colors) do - values["color" .. (i - 1)] = v.hex + local values = { + selection_background = theme.Visual.bg.hex, + } + for i, v in ipairs(terminal.colors) do + values["color" .. (i - 1)] = v.hex + end + + return { string.format("extras/tmux/%s.tmux", name), template, values } end - -return { "extras/tmux/zenbones.tmux", template, values } diff --git a/lua/zenbones/build/vim.lua b/lua/zenbones/build/vim.lua index 2b77fd0..fb5ab7b 100644 --- a/lua/zenbones/build/vim.lua +++ b/lua/zenbones/build/vim.lua @@ -1,6 +1,4 @@ local lush = require "lush" -local theme = require "zenbones" -local terminal = require "zenbones.terminal" local template = [[if exists('g:colors_name') highlight clear @@ -9,7 +7,7 @@ local template = [[if exists('g:colors_name') endif set background=light -let g:colors_name = 'zenbones' +let g:colors_name = '${name}' ${termcolors} if has('terminal') @@ -36,19 +34,24 @@ endif ${vimcolors} ]] -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) +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 + + -- 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, + { + name = name, + termcolors = termcolors, + vimcolors = vimcolors, + }, + } 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") - -return { - "colors/zenbones.vim", - template, - { - termcolors = termcolors, - vimcolors = vimcolors, - }, -} diff --git a/lua/zenbones/build/wezterm.lua b/lua/zenbones/build/wezterm.lua index 3af01bd..a6ce30e 100644 --- a/lua/zenbones/build/wezterm.lua +++ b/lua/zenbones/build/wezterm.lua @@ -1,4 +1,4 @@ -local template = [[# Zenbones +local template = [[# ${name} [colors] foreground = "${fg}" background = "${bg}" @@ -12,20 +12,25 @@ ansi = ["${color0}", "${color1}", "${color2}", "${color3}", "${color4}", "${colo brights = ["${color8}", "${color9}", "${color10}", "${color11}", "${color12}", "${color13}", "${color14}", "${color15}"] ]] -local theme = require "zenbones" -local terminal = require "zenbones.terminal" +return function(name) + local theme = require(name) + local terminal = require(name .. ".terminal") -local values = { - 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, -} -for i, v in ipairs(terminal.colors) do - values["color" .. (i - 1)] = v.hex + 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, + } + for i, v in ipairs(terminal.colors) do + values["color" .. (i - 1)] = v.hex + end + + return { string.format("extras/wezterm/%s.toml", name), template, values } end - -return { "extras/wezterm/Zenbones.toml", template, values }