auto generate docs

This commit is contained in:
mcchrish
2021-10-11 05:57:15 +00:00
committed by GitHub Actions
parent ad6bbe7e8d
commit 1fdce6cfd4

View File

@@ -114,7 +114,9 @@ colors in lua:
< <
Heres an example of how to extend/override some highlights: Heres an example of how to extend/override some highlights.
`lua/customize_zenbones.lua`:
> >
local function customize_zenbones() local function customize_zenbones()
@@ -125,12 +127,13 @@ Heres an example of how to extend/override some highlights:
local lush = require "lush" local lush = require "lush"
local base = require "zenbones" local base = require "zenbones"
-- Create some specs
local specs = lush.parse(function() local specs = lush.parse(function()
return { return {
TabLine { base.TabLine, gui = "italic" }, -- setting gui to "italic" TabLine { base.TabLine, gui = "italic" }, -- setting gui to "italic"
}
end) end)
-- Apply specs using lush tool-chain
lush.apply(lush.compile(specs)) lush.apply(lush.compile(specs))
end end
@@ -138,7 +141,7 @@ Heres an example of how to extend/override some highlights:
< <
And then somewhere in your config: And then somewhere in your `init.vim`:
> >
autocmd VimEnter,ColorScheme * lua require("customize_zenbones")() autocmd VimEnter,ColorScheme * lua require("customize_zenbones")()
@@ -151,25 +154,25 @@ See also Lushs documentation
CREATE YOUR OWN COLORSCHEME ~ CREATE YOUR OWN COLORSCHEME ~
You can ultimately create your own colorscheme that is based on Zenbones by You can ultimately create your own colorscheme that is based on Zenbones by
modifying the base palette and extending the specs. Best way to demonstrate defining a palette and generating a specs. Best way to demonstrate this is
this is through an example. Lets make a zenbones-flavored Gruvbox through an example. Lets make a zenbones-flavored Gruvbox colorscheme called
colorscheme called `gruvbones`. `gruvbones`.
Lets define our |colorscheme| in `nvim/colors/gruvbones.lua`. And it Lets define our |colorscheme| in `nvim/colors/gruvbones.lua`. And it
contains the following: contains the following:
> >
vim.g.colors_name = "gruvbones" vim.g.colors_name = "gruvbones" -- Required when defining a colorscheme
local lush = require "lush" local lush = require "lush"
local hsluv = lush.hsluv -- human-friendly hsl local hsluv = lush.hsluv -- Human-friendly hsl
local util = require "zenbones.util" local util = require "zenbones.util"
-- let's base bg=dark, bg=light on zenflesh, zenbones specs respectively -- Let's base bg=dark, bg=light on zenflesh, zenbones specs respectively
local base_name = util.bg_to_base_name() local base_name = util.bg_to_base_name()
-- create a palette. Use palette_extend to fill unspecified colors -- Define a palette. Use `palette_extend` to fill unspecified colors
-- based on https://github.com/gruvbox-community/gruvbox#palette -- Based on https://github.com/gruvbox-community/gruvbox#palette
local palette local palette
if base_name == "zenbones" then if base_name == "zenbones" then
palette = util.palette_extend({ palette = util.palette_extend({
@@ -195,11 +198,11 @@ contains the following:
}, "zenflesh") }, "zenflesh")
end end
-- generate the lush specs using the generator util -- Generate the lush specs using the generator util
local generator = require(base_name .. ".specs") local generator = require(base_name .. ".specs")
local base_specs = generator.generate(palette, generator.get_global_config(base_name)) local base_specs = generator.generate(palette, generator.get_global_config(base_name))
-- optionally extend specs using Lush -- Optionally extend specs using Lush
local specs = lush.extends({ base_specs }).with(function() local specs = lush.extends({ base_specs }).with(function()
return { return {
Statement { base_specs.Statement, fg = palette.rose }, Statement { base_specs.Statement, fg = palette.rose },
@@ -208,10 +211,10 @@ contains the following:
} }
end) end)
-- include our theme file and pass it to lush to apply -- Pass the specs to lush to apply
lush(specs) lush(specs)
-- optionally, set term colors -- Optionally set term colors
require("zenbones.term").apply_colors(palette) require("zenbones.term").apply_colors(palette)
< <