Files
zenbones-theme/lua/zenbones/build/vim.lua

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

59 lines
1.6 KiB
Lua
Raw Normal View History

2021-09-04 16:02:45 +08:00
local lush = require "lush"
2021-09-04 16:40:29 +08:00
local template = [[if exists('g:colors_name')
highlight clear
syntax reset
set t_Co=256
endif
2021-09-14 06:38:07 +08:00
set background=${background}
2021-09-14 05:53:51 +08:00
let g:colors_name = '${name}'
2021-09-04 16:40:29 +08:00
${termcolors}
if has('terminal')
let g:terminal_ansi_colors = [
\ g:terminal_color_0,
\ g:terminal_color_1,
\ g:terminal_color_2,
\ g:terminal_color_3,
\ g:terminal_color_4,
\ g:terminal_color_5,
\ g:terminal_color_6,
\ g:terminal_color_7,
\ g:terminal_color_8,
\ g:terminal_color_9,
\ g:terminal_color_10,
\ g:terminal_color_11,
\ g:terminal_color_12,
\ g:terminal_color_13,
\ g:terminal_color_14,
\ g:terminal_color_15
\ ]
endif
${vimcolors}
]]
2021-09-14 05:53:51 +08:00
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
2021-09-04 16:02:45 +08:00
2021-09-14 05:53:51 +08:00
-- 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")
2021-09-04 16:02:45 +08:00
2021-09-14 05:53:51 +08:00
return {
string.format("colors/%s.vim", name),
template,
{
2021-09-14 06:38:07 +08:00
background = name == "zenbones" and "light" or "dark",
2021-09-14 05:53:51 +08:00
name = name,
termcolors = termcolors,
vimcolors = vimcolors,
},
}
end