Skip to content

Steps to use shipwright to export lush.nvim themes

source: https://github.com/rktjmp/lush.nvim/blob/main/BUILD.md#exporting-a-colorscheme-to-configurable-lua

I) Install shipwright

Since I don't use a package manager..

cd ~/.config/nvim/pack/colorschemes/start
git clone 'https://github.com/rktjmp/shipwright.nvim.git'

Create files shipwright_build.lua and colors/vectorspacexyz.lua

touch ~/.config/nvim/pack/colorschemes/start/shipwright.nvim/lua/shipwright_build.lua
mkdir ~/.config/nvim/pack/colorschemes/start/shipwright.nvim/lua/colors
touch ~/.config/nvim/pack/colorschemes/start/shipwright.nvim/lua/colors/vectorspacexyz.lua

shipwright_build.lua:

local colorscheme = require("lush_theme.vector")
local lushwright = require("shipwright.transform.lush")
run(colorscheme,
  lushwright.to_lua,
  {patchwrite, "colors/vectorspacexyz.lua", "-- PATCH_OPEN", "-- PATCH_CLOSE"})

How did you get "lush_theme.vector" here? vector.lua is the name of the file that contains highlight definitions in my lush colorscheme project:

1740932342.png

vectorspacexyz.lua:

-- colors/colorscheme.lua

local colors = {
-- content here will not be touched
-- PATCH_OPEN
-- group data will be inserted here
-- PATCH_CLOSE
-- content here will not be touched
}

-- colorschemes generally want to do this
vim.cmd("highlight clear")
vim.cmd("set t_Co=256")
vim.cmd("let g:colors_name='my_theme'")

-- apply highlight groups
for group, attrs in pairs(colors) do
  vim.api.nvim_set_hl(0, group, attrs)
end
cd /home/vector/.config/nvim/pack/colorschemes/start/shipwright.nvim/lua
nvim shipwright_build.lua

And..

:Shipwright

Comments