Files
zenbones-theme/doc/zenbones.md

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

225 lines
5.8 KiB
Markdown
Raw Normal View History

2021-09-18 16:11:00 +08:00
# Zenbones
2021-09-18 16:07:20 +08:00
2021-09-18 16:11:00 +08:00
**Zenflesh, Zenbones** is a vim/neovim colorscheme designed to highlight code
using contrasts and font variations. Colors are tasked only for other roles such
as diagnostics, diffs, search matches.
2021-09-18 16:07:20 +08:00
## Usage
Just apply the colorscheme as usual:
```vim
colorscheme zenbones " light
colorscheme zenflesh " dark
2021-09-21 19:29:37 +08:00
2021-10-15 16:29:33 +08:00
colorscheme zenwritten " Zero hue and saturation version
2021-10-14 18:16:24 +08:00
colorscheme neobones " https://neovim.io flavor
colorscheme rosebones " Rosé Pine flavor - https://rosepinetheme.com
colorscheme forestbones " Everforest flavor - https://github.com/sainnhe/everforest
2021-10-15 16:29:33 +08:00
colorscheme nordbones " Nord flavor - https://www.nordtheme.com/docs/colors-and-palettes
2021-10-15 18:13:07 +08:00
colorscheme tokyobones " Tokyo Night flavor - https://github.com/enkia/tokyo-night-vscode-theme#color-palette
2021-09-18 16:07:20 +08:00
```
It works pretty much the same as the first one but pretty handy when extending
or customizing the colors to your likings.
## Configuration
2021-10-10 14:27:37 +08:00
Configuration is only available for neovim.
2021-09-18 16:07:20 +08:00
2021-10-20 15:15:31 +08:00
**Note**: Flavors accept their own configuration by replacing "zenbones" or
"zenflesh" prefix with the flavor name e.g. `g:rosebones_italic_comments`.
2021-09-18 16:07:20 +08:00
#### g:zenbones_lightness
Change background colors lightness. Options: `'bright'`, `'dim'`.
#### g:zenflesh_darkness
Change background colors darkness. Options: `'stark'`, `'warm'`.
#### g:zenbones_solid_vert_split
#### g:zenflesh_solid_vert_split
2021-10-20 17:14:48 +08:00
Default: `v:false`. Make VertSplit more distinguishable background highlight.
2021-09-18 16:07:20 +08:00
2021-10-20 17:22:40 +08:00
#### g:zenbones_darken_line_nr
2021-10-20 16:25:48 +08:00
Default: `v:false`. Darken LineNr background.
2021-10-20 17:22:40 +08:00
#### g:zenflesh_lighten_line_nr
2021-10-20 16:25:48 +08:00
Default: `v:false`. Lighten LineNr background.
2021-10-20 17:14:48 +08:00
#### g:zenbones_solid_float_border
#### g:zenflesh_solid_float_border
Default: `v:false`. Make FloatBorder more distinguishable background highlight.
2021-09-18 16:07:20 +08:00
#### g:zenbones_dim_noncurrent_window
2021-09-18 16:16:25 +08:00
Default: `v:false`. Make non-current window background dimmer than _Normal_.
2021-09-18 16:07:20 +08:00
#### g:zenflesh_lighten_noncurrent_window
2021-09-18 16:16:25 +08:00
Default: `v:false`. Make non-current window background warmer than _Normal_.
2021-09-18 16:07:20 +08:00
#### g:zenbones_italic_comments
#### g:zenflesh_italic_comments
2021-10-01 07:41:03 +08:00
Default: `v:true`. Make comments italicize.
2021-10-20 15:35:17 +08:00
#### g:zenbones_darken_comments
2021-10-20 16:25:48 +08:00
Default: 38. Percentage to darken comments. Comments base their foreground color
on the bg palette. See also |lush-color-darken|.
2021-10-20 15:35:17 +08:00
#### g:zenflesh_lighten_comments
2021-10-20 16:25:48 +08:00
Default: 38. Percentage to lighten comments. Comments base their foreground
color on the bg palette. See also |lush-color-lighten|.
2021-10-20 15:35:17 +08:00
2021-10-10 19:23:08 +08:00
#### g:zenbones_compat
Set to `1` to turn on compatibility mode.
2021-10-01 07:41:03 +08:00
#### lightline
```vim
let g:lightline = {
\ 'colorscheme': 'zenbones', " or 'zenflesh'
\ }
```
#### lualine
```lua
options = { theme = 'zenbones' } -- or 'zenflesh'
```
2021-09-18 16:07:20 +08:00
## Advanced Usage
Zenbones is pretty extensible thanks to Lush. You can easily retrieve the colors
in lua:
```lua
local theme = require "zenbones" -- or zenflesh
local palette = require "zenbones.palette"
print(theme.StatusLine.bg.hex)
print(palette.blossom.darken(20).hex)
```
2021-10-11 11:18:09 +08:00
Here's an example of how to extend/override some highlights.
`lua/customize_zenbones.lua`:
```lua
local function customize_zenbones()
if vim.g.colors_name ~= "zenbones" then
return
end
local lush = require "lush"
local base = require "zenbones"
2021-10-11 11:18:09 +08:00
-- Create some specs
local specs = lush.parse(function()
return {
TabLine { base.TabLine, gui = "italic" }, -- setting gui to "italic"
2021-10-20 15:15:31 +08:00
end)
2021-10-11 11:18:09 +08:00
-- Apply specs using lush tool-chain
lush.apply(lush.compile(specs))
end
return customize_zenbones
```
2021-10-11 11:18:09 +08:00
And then somewhere in your `init.vim`:
```vim
autocmd VimEnter,ColorScheme * lua require("customize_zenbones")()
```
2021-09-18 16:07:20 +08:00
See also
[Lush's documentation](https://github.com/rktjmp/lush.nvim#advanced-usage) for
more options.
### Create your own colorscheme
You can ultimately create your own colorscheme that is based on Zenbones by
2021-10-20 15:15:31 +08:00
defining a palette and generating a specs. Best way to demonstrate this is
through an example. Let's make a zenbones-flavored Gruvbox colorscheme called
`gruvbones`.
Let's define our
[colorscheme](https://neovim.io/doc/user/syntax.html#:colorscheme) in
`nvim/colors/gruvbones.lua`. And it contains the following:
```lua
2021-10-11 11:18:09 +08:00
vim.g.colors_name = "gruvbones" -- Required when defining a colorscheme
local lush = require "lush"
2021-10-11 11:18:09 +08:00
local hsluv = lush.hsluv -- Human-friendly hsl
2021-10-10 15:02:17 +08:00
local util = require "zenbones.util"
local bg = vim.opt.background:get()
2021-10-11 11:18:09 +08:00
-- Define a palette. Use `palette_extend` to fill unspecified colors
-- Based on https://github.com/gruvbox-community/gruvbox#palette
2021-10-10 15:02:17 +08:00
local palette
if bg == "light" then
2021-10-10 15:02:17 +08:00
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
2021-10-10 15:02:17 +08:00
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
2021-10-11 11:18:09 +08:00
-- Generate the lush specs using the generator util
local generator = require "zenbones.specs"
local base_specs = generator.generate(palette, bg, generator.get_global_config("gruvbones", bg))
2021-10-11 11:18:09 +08:00
-- Optionally extend specs using Lush
2021-10-10 15:02:17 +08:00
local specs = lush.extends({ base_specs }).with(function()
return {
2021-10-10 15:02:17 +08:00
Statement { base_specs.Statement, fg = palette.rose },
Special { fg = palette.water },
Type { fg = palette.sky, gui = "italic" },
}
end)
2021-10-11 11:18:09 +08:00
-- Pass the specs to lush to apply
lush(specs)
2021-10-10 15:02:17 +08:00
2021-10-11 11:18:09 +08:00
-- Optionally set term colors
2021-10-10 15:02:17 +08:00
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 [neobones](../colors/neobones.lua) and
2021-10-04 20:02:41 +08:00
[rosebones](../colors/rosebones.lua) colorscheme for a similar and complete
example.