diff --git a/lua/zenbones/build.lua b/lua/zenbones/build.lua index 55ad332..a4919b3 100644 --- a/lua/zenbones/build.lua +++ b/lua/zenbones/build.lua @@ -22,19 +22,27 @@ end local config_set = { { - name = "zenbones", - palette = require "zenbones.palette", - opt = { - template_opt = { - vim = { bg = "light" }, - }, - }, + name = "zenbones_light", + specs = "zenbones", + palette = require("zenbones.palette").light, + setup = function() + vim.opt.background = "light" + end, + }, + + { + name = "zenbones_dark", + specs = "zenbones", + palette = require("zenbones.palette").dark, + setup = function() + vim.opt.background = "dark" + end, }, { name = "zenbones_bright", specs = "zenbones", - palette = require "zenbones.palette", + palette = require("zenbones.palette").light, setup = function() vim.g.zenbones_lightness = "bright" end, @@ -49,7 +57,7 @@ local config_set = { { name = "zenbones_dim", specs = "zenbones", - palette = require "zenbones.palette", + palette = require("zenbones.palette").light, setup = function() vim.g.zenbones_lightness = "dim" end, @@ -61,40 +69,35 @@ local config_set = { }, }, - { - name = "zenflesh", - palette = require "zenflesh.palette", - }, - - { - name = "zenflesh_stark", - specs = "zenflesh", - palette = require "zenflesh.palette", - setup = function() - vim.g.zenflesh_darkness = "stark" - end, - cleanup = function() - vim.api.nvim_del_var "zenflesh_darkness" - end, - opt = { - exclude = { "vim", "lightline", "lualine" }, - }, - }, - - { - name = "zenflesh_warm", - specs = "zenflesh", - palette = require "zenflesh.palette", - setup = function() - vim.g.zenflesh_darkness = "warm" - end, - cleanup = function() - vim.api.nvim_del_var "zenflesh_darkness" - end, - opt = { - exclude = { "vim", "lightline", "lualine" }, - }, - }, + -- { + -- name = "zenflesh_stark", + -- specs = "zenflesh", + -- palette = require "zenflesh.palette", + -- setup = function() + -- vim.g.zenflesh_darkness = "stark" + -- end, + -- cleanup = function() + -- vim.api.nvim_del_var "zenflesh_darkness" + -- end, + -- opt = { + -- exclude = { "vim", "lightline", "lualine" }, + -- }, + -- }, + -- + -- { + -- name = "zenflesh_warm", + -- specs = "zenflesh", + -- palette = require "zenflesh.palette", + -- setup = function() + -- vim.g.zenflesh_darkness = "warm" + -- end, + -- cleanup = function() + -- vim.api.nvim_del_var "zenflesh_darkness" + -- end, + -- opt = { + -- exclude = { "vim", "lightline", "lualine" }, + -- }, + -- }, { name = "neobones_light", @@ -218,7 +221,7 @@ local config_set = { { name = "nordbones", - palette = require("nordbones.palette").derived, + palette = require("nordbones.palette").dark, opt = { exclude = { "alacritty", "iterm", "kitty", "tmux", "wezterm" }, }, diff --git a/lua/zenbones/init.lua b/lua/zenbones/init.lua index 4d63812..fb12a3e 100644 --- a/lua/zenbones/init.lua +++ b/lua/zenbones/init.lua @@ -1,4 +1,5 @@ local generator = require "zenbones.specs" -local p = require "zenbones.palette" +local bg = vim.opt.background:get() +local p = require("zenbones.palette")[bg] -return generator.generate(p, "light", generator.get_global_config("zenbones", "light")) +return generator.generate(p, bg, generator.get_global_config("zenbones", bg)) diff --git a/lua/zenbones/palette.lua b/lua/zenbones/palette.lua index bc69c42..568ae55 100644 --- a/lua/zenbones/palette.lua +++ b/lua/zenbones/palette.lua @@ -1,3 +1,8 @@ local util = require "zenbones.util" -return util.palette_extend({}, "light") +local M = {} + +M.light = util.palette_extend({}, "light") +M.dark = util.palette_extend {} + +return M diff --git a/lua/zenbones/template/vim.lua b/lua/zenbones/template/vim.lua index 91a529c..6d2a99e 100644 --- a/lua/zenbones/template/vim.lua +++ b/lua/zenbones/template/vim.lua @@ -1,21 +1,10 @@ local template = [[" This file is auto-generated from lua/zenbones/template/vim.lua -if exists('g:colors_name') - highlight clear -endif - -set background=${background} -let g:colors_name = '${name}' +function! ${name}#load() ${termcolors} -if has('nvim') && (!exists('g:${name}_compat') || g:${name}_compat == 0) - lua package.loaded["${specs_path}"] = nil - lua require "lush"(require "${specs_path}", { force_clean = false }) - finish -else ${vimcolors} highlight! link StatusLineTerm StatusLine highlight! link StatusLineTermNC StatusLineNC -endif if has('terminal') let g:terminal_ansi_colors = [ @@ -37,10 +26,12 @@ if has('terminal') \ g:terminal_color_15 \ ] endif + +endfunction ]] -local lush = require "lush" -return function(name, specs, p, opt) +return function(name, specs, p) + local lush = require "lush" local term = require("zenbones.term").colors_map(p) local termcolors = "" for i, v in ipairs(term) do @@ -55,12 +46,11 @@ return function(name, specs, p, opt) local vimcolors = table.concat(vim.fn.sort(compiled), "\n") return { - string.format("colors/%s.vim", name), + string.format("autoload/%s.vim", name), template, { name = name, specs_path = name, - background = opt.bg or "dark", termcolors = termcolors, vimcolors = vimcolors, },