diff --git a/doc/zenbones.txt b/doc/zenbones.txt index 180e80c..e63e6fc 100644 --- a/doc/zenbones.txt +++ b/doc/zenbones.txt @@ -22,15 +22,6 @@ Just apply the colorscheme as usual: > colorscheme zenbones " light colorscheme zenflesh " dark -< - - -If you want to make use of the lua version: - -> - " Requires `neovim` and `rktjmp/lush.nvim` installed - colorscheme zenbones-lush - colorscheme zenflesh-lush " https://neovim.io flavor colorscheme neobones @@ -44,7 +35,7 @@ or customizing the colors to your likings. CONFIGURATION *zenbones-configuration* -Configuration is only available for `zenbones-lush` and `zenflesh-lush`. +Configuration is only available for neovim. *zenbones-g:zenbones_lightness* @@ -117,6 +108,37 @@ colors in lua: < +Here’s an example of how to extend/override some highlights: + +> + local function customize_zenbones() + if vim.g.colors_name ~= "zenbones" then + return + end + + local lush = require "lush" + local base = require "zenbones" + + local specs = lush.parse(function() + return { + TabLine { base.TabLine, gui = "italic" }, -- setting gui to "italic" + } + end) + + lush.apply(lush.compile(specs)) + end + + return customize_zenbones +< + + +And then somewhere in your config: + +> + autocmd VimEnter,ColorScheme * lua require("customize_zenbones")() +< + + See also Lush’s documentation for more options. @@ -133,77 +155,65 @@ contains the following: > vim.g.colors_name = "gruvbones" - -- let's base bg=dark, bg=light on zenflesh, zenbones specs respectively - local base_name = vim.opt.background:get() == "dark" and "zenflesh" or "zenbones" - - -- reset base palette and specs - package.loaded[base_name .. ".palette"] = nil - package.loaded[base_name] = nil - local lush = require "lush" - local hsl = lush.hsl + local hsluv = lush.hsluv -- human-friendly hsl + local util = require "zenbones.util" - -- modify base palette (before requiring specs) - -- and we can also define our own - -- note: non-exhaustive copy of gruvbox palette. Ref: https://github.com/gruvbox-community/gruvbox#palette - local base = require(base_name .. ".palette") - local gruv + -- let's base bg=dark, bg=light on zenflesh, zenbones specs respectively + local base_name = util.bg_to_base_name() + + -- create a palette. Use palette_extend to fill unspecified colors + -- based on https://github.com/gruvbox-community/gruvbox#palette + local palette if base_name == "zenbones" then - base.bg = hsl "#fbf1c7" - base.fg = hsl "#3c3836" - gruv = { - gray = hsl "#7c6f64", - fg0 = hsl "#282828", - fg1 = hsl "#3c3836", - fg2 = hsl "#504945", - fg3 = hsl "#665c54", - fg4 = hsl "#7c6f64", - } + palette = util.palette_extend({ + bg = hsluv "#fbf1c7", + fg = hsluv "#3c3836", + rose = hsluv "#9d0006", + leaf = hsluv "#79740e", + wood = hsluv "#b57614", + water = hsluv "#076678", + blossom = hsluv "#8f3f71", + sky = hsluv "#427b58", + }, "zenbones") else - base.bg = hsl "#282828" - base.fg = hsl "#ebdbb2" - gruv = { - gray = hsl "#a89984", - fg0 = hsl "#fbf1c7", - fg1 = hsl "#ebdbb2", - fg2 = hsl "#d5c4a1", - fg3 = hsl "#d5c4a1", - fg4 = hsl "#a89984", - } + palette = util.palette_extend({ + bg = hsluv "#282828", + fg = hsluv "#ebdbb2", + rose = hsluv "#fb4934", + leaf = hsluv "#b8bb26", + wood = hsluv "#fabd2f", + water = hsluv "#83a598", + blossom = hsluv "#d3869b", + sky = hsluv "#83c07c", + }, "zenflesh") end - base.rose = hsl "#cc241d" - base.leaf = hsl "#98971a" - base.wood = hsl "#d79921" - base.water = hsl "#458588" - base.blossom = hsl "#b16286" - base.sky = hsl "#689d6a" + -- generate the lush specs using the generator util + local generator = require(base_name .. ".specs") + local base_specs = generator.generate(palette, generator.get_global_config(base_name)) - -- extend specs using Lush - local theme = require(base_name) - local specs = lush.extends({ theme }).with(function() + -- optionally extend specs using Lush + local specs = lush.extends({ base_specs }).with(function() return { - Constant { fg = gruv.fg4, gui = "italic" }, - Identifier { fg = gruv.fg2, gui = "italic" }, - Special { fg = gruv.fg3, gui = "bold" }, - Delimiter { fg = gruv.gray }, - Comment { fg = gruv.gray, gui = "italic" }, - LineNr { fg = Comment.fg }, + Statement { base_specs.Statement, fg = palette.rose }, + Special { fg = palette.water }, + Type { fg = palette.sky, gui = "italic" }, } end) - -- apply terminal colors - require(base_name .. ".term").setup() - -- include our theme file and pass it to lush to apply lush(specs) + + -- optionally, set term colors + require("zenbones.term").apply_colors(palette) < And there you have it. Just call `colorscheme gruvbones` to use your new colorscheme. It respects `&background` and other configurations too. -Also checkout the neovim <../colors/neovim.lua> and rosebones +Also checkout the neobones <../colors/neobones.lua> and rosebones <../colors/rosebones.lua> colorscheme for a similar and complete example. Generated by panvimdoc