diff --git a/lua/zenbones/shipwright/init.lua b/lua/zenbones/shipwright/init.lua new file mode 100644 index 0000000..0c5776a --- /dev/null +++ b/lua/zenbones/shipwright/init.lua @@ -0,0 +1,32 @@ +local M = {} + +local function make_env(colorscheme) + local builder = require "shipwright.builder" + local env = builder.make_env() + + local name = colorscheme.name + env.name = name + + vim.opt.background = "light" + package.loaded[name] = nil + env.specs = require(name) + env.p = require(name .. ".palette").light + env.term = require("zenbones.term").colors_map(env.p) + env.transform = require "zenbones.shipwright.transform" + return env +end + +M.run = function() + local runners = { "alacritty", "kitty" } + for _, runner in ipairs(runners) do + local build_fn = loadfile(string.format("lua/zenbones/shipwright/runners/%s.lua", runner)) + assert(pcall(setfenv( + build_fn, + make_env { + name = "zenbones", + } + ))) + end +end + +return M diff --git a/lua/zenbones/shipwright/runners/alacritty.lua b/lua/zenbones/shipwright/runners/alacritty.lua new file mode 100644 index 0000000..1a8d0ee --- /dev/null +++ b/lua/zenbones/shipwright/runners/alacritty.lua @@ -0,0 +1,7 @@ +run( + { specs, p, term }, + transform.colorscheme_to_term_colors, + contrib.alacritty, + { prepend, "# This file is auto-generated by shipwright.nvim", }, + { overwrite, string.format("extras/alacritty/%s.yml", name) } +) diff --git a/lua/zenbones/shipwright/runners/kitty.lua b/lua/zenbones/shipwright/runners/kitty.lua new file mode 100644 index 0000000..cbe5a6f --- /dev/null +++ b/lua/zenbones/shipwright/runners/kitty.lua @@ -0,0 +1,22 @@ +run( + { specs, p, term }, + transform.colorscheme_to_term_colors, + function(colors) + return vim.tbl_extend("keep", colors, { + name = name, + author = "Michael Chris Lopez", + license = "MIT", + upstream = string.format("https://github.com/mcchrish/zenbones.nvim/raw/main/extras/kitty/%s.conf", name), + selection_bg = specs.Visual.bg.hex, + selection_fg = colors.fg, + url_color = term[13].hex, + tab_active_bg = specs.Search.bg.hex, + tab_active_fg = colors.fg, + tab_inactive_bg = specs.StatusLine.bg.hex, + tab_inactive_fg = colors.fg, + }) + end, + contrib.kitty, + { prepend, "# This file is auto-generated by shipwright.nvim" }, + { overwrite, string.format("extras/kitty/%s.conf", name) } +) diff --git a/lua/zenbones/shipwright/transform.lua b/lua/zenbones/shipwright/transform.lua new file mode 100644 index 0000000..61fe762 --- /dev/null +++ b/lua/zenbones/shipwright/transform.lua @@ -0,0 +1,29 @@ +local M = {} + +M.colorscheme_to_term_colors = function(colorscheme) + local specs, _, term = unpack(colorscheme) + return { + fg = specs.Normal.fg.hex, + bg = specs.Normal.bg.hex, + cursor_fg = specs.Cursor.fg.hex, + cursor_bg = specs.Cursor.bg.hex, + black = term[1].hex, + red = term[2].hex, + green = term[3].hex, + yellow = term[4].hex, + blue = term[5].hex, + magenta = term[6].hex, + cyan = term[7].hex, + white = term[8].hex, + bright_black = term[9].hex, + bright_red = term[10].hex, + bright_green = term[11].hex, + bright_yellow = term[12].hex, + bright_blue = term[13].hex, + bright_magenta = term[14].hex, + bright_cyan = term[15].hex, + bright_white = term[16].hex, + } +end + +return M diff --git a/makefile b/makefile index 94f84ad..2b2289b 100644 --- a/makefile +++ b/makefile @@ -1,5 +1,5 @@ make: nvim --headless -u NORC \ --cmd 'set rtp+=.' \ - --cmd 'lua require("zenbones.build").run()' \ + --cmd 'lua require("zenbones.shipwright").run()' \ --cmd 'q'