initial shipwright integration
This commit is contained in:
32
lua/zenbones/shipwright/init.lua
Normal file
32
lua/zenbones/shipwright/init.lua
Normal 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
|
||||
7
lua/zenbones/shipwright/runners/alacritty.lua
Normal file
7
lua/zenbones/shipwright/runners/alacritty.lua
Normal 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) }
|
||||
)
|
||||
22
lua/zenbones/shipwright/runners/kitty.lua
Normal file
22
lua/zenbones/shipwright/runners/kitty.lua
Normal 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) }
|
||||
)
|
||||
29
lua/zenbones/shipwright/transform.lua
Normal file
29
lua/zenbones/shipwright/transform.lua
Normal 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
|
||||
Reference in New Issue
Block a user