Now standalone plugin
First impl of standalone colorscheme
This commit is contained in:
36
lua/astrobox/init.lua
Normal file
36
lua/astrobox/init.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
local palette = require("astrobox.palette")
|
||||
local highlights = require("astrobox.highlights")
|
||||
|
||||
local default_cfg = {
|
||||
contrast = "default", -- soft, default or hard
|
||||
overrides = {}
|
||||
}
|
||||
|
||||
local M = {
|
||||
cfg = {},
|
||||
palette = {},
|
||||
hl = {},
|
||||
}
|
||||
|
||||
function M.setup(user_cfg)
|
||||
M.cfg = user_cfg
|
||||
end
|
||||
|
||||
function M.set_highlights(list)
|
||||
for hl, def in pairs(list) do
|
||||
vim.api.nvim_set_hl(0, hl, def)
|
||||
end
|
||||
end
|
||||
|
||||
function M.load()
|
||||
local cfg = vim.tbl_extend("force", default_cfg, M.cfg or {})
|
||||
M.palette = palette(cfg)
|
||||
M.hl = highlights(M.palette, cfg)
|
||||
for index, color in ipairs(M.palette.term_colors) do
|
||||
vim.g["terminal_color_" .. index - 1] = color
|
||||
end
|
||||
vim.g.colors_name = "astrobox"
|
||||
M.set_highlights(M.hl)
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user