initial shipwright integration

This commit is contained in:
Michael Chris Lopez
2021-11-05 14:43:28 +08:00
parent 265ab617de
commit 3ef0de509c
5 changed files with 91 additions and 1 deletions

View File

@@ -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

View File

@@ -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) }
)

View File

@@ -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) }
)

View File

@@ -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

View File

@@ -1,5 +1,5 @@
make: make:
nvim --headless -u NORC \ nvim --headless -u NORC \
--cmd 'set rtp+=.' \ --cmd 'set rtp+=.' \
--cmd 'lua require("zenbones.build").run()' \ --cmd 'lua require("zenbones.shipwright").run()' \
--cmd 'q' --cmd 'q'