2021-09-18 16:11:00 +08:00
|
|
|
# Zenbones
|
2021-09-18 16:07:20 +08:00
|
|
|
|
2021-10-27 19:17:10 +08:00
|
|
|
Zenbones is a collection of vim/neovim colorschemes 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
|
2021-10-27 17:14:39 +08:00
|
|
|
set termguicolors
|
|
|
|
|
|
2021-11-01 17:06:22 +08:00
|
|
|
colorscheme zenbones
|
2021-09-21 19:29:37 +08:00
|
|
|
|
2021-10-27 17:14:39 +08:00
|
|
|
colorscheme zenwritten " Zero hue and saturation version
|
|
|
|
|
colorscheme neobones " https://neovim.io flavor
|
2021-10-31 08:34:57 +08:00
|
|
|
colorscheme vimbones " https://www.vim.org flavor
|
2021-10-27 17:14:39 +08:00
|
|
|
colorscheme rosebones " Rosé Pine flavor - https://rosepinetheme.com
|
|
|
|
|
colorscheme forestbones " Everforest flavor - https://github.com/sainnhe/everforest
|
|
|
|
|
colorscheme nordbones " Nord flavor - https://www.nordtheme.com/docs/colors-and-palettes
|
|
|
|
|
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-27 18:08:58 +08:00
|
|
|
Configuration is only available for neovim. There are two ways to set
|
|
|
|
|
configuration. First:
|
2021-10-27 17:44:38 +08:00
|
|
|
|
2021-10-27 16:49:45 +08:00
|
|
|
```vim
|
2021-10-28 06:16:31 +08:00
|
|
|
" vimscript
|
2021-10-27 18:08:58 +08:00
|
|
|
let g:zenbones_solid_line_nr = v:true
|
|
|
|
|
let g:zenbones_darken_comments = 45
|
2021-10-27 16:49:45 +08:00
|
|
|
```
|
2021-10-27 17:44:38 +08:00
|
|
|
|
2021-10-27 16:49:45 +08:00
|
|
|
```lua
|
2021-10-28 06:16:31 +08:00
|
|
|
-- lua
|
2021-10-27 18:08:58 +08:00
|
|
|
vim.g.zenbones_solid_line_nr = true
|
|
|
|
|
vim.g.zenbones_darken_comments = 45
|
2021-10-27 16:49:45 +08:00
|
|
|
```
|
|
|
|
|
|
2021-10-27 18:08:58 +08:00
|
|
|
Second way is to set configuration is to assign a dictionary to the prefix:
|
2021-09-18 16:07:20 +08:00
|
|
|
|
2021-10-27 18:08:58 +08:00
|
|
|
```vim
|
2021-10-28 06:16:31 +08:00
|
|
|
" vimscript
|
2021-10-27 18:08:58 +08:00
|
|
|
let g:forestbones = #{ solid_line_nr: v:true, darken_comments: 45 }
|
|
|
|
|
```
|
2021-10-26 17:33:01 +08:00
|
|
|
|
2021-10-27 18:08:58 +08:00
|
|
|
```lua
|
2021-10-28 06:16:31 +08:00
|
|
|
-- lua
|
2021-10-27 18:08:58 +08:00
|
|
|
vim.g.forestbones = { solid_line_nr = true, darken_comments = 45 }
|
|
|
|
|
```
|
2021-10-26 17:33:01 +08:00
|
|
|
|
2021-10-27 18:08:58 +08:00
|
|
|
**Notes**: Flavors accept their own configuration by replacing the prefix with
|
|
|
|
|
the flavor name e.g. `g:rosebones_italic_comments`.
|
|
|
|
|
|
2021-11-03 16:17:41 +08:00
|
|
|
| Option | Background | Default | Description |
|
|
|
|
|
| ------------------------- | ---------- | ------- | ------------------------------------------------------------------------- |
|
|
|
|
|
| lightness | light | `nil` | Change background colors lightness. Options: `'bright'`, `'dim'`. |
|
|
|
|
|
| darkness | dark | `nil` | Change background colors darkness. Options: `'stark'`, `'warm'`. |
|
|
|
|
|
| solid_vert_split | both | `false` | Solid \|hl-VertSplit\| background. |
|
|
|
|
|
| solid_line_nr | both | `false` | Solid \|hl-LineNr\| background. |
|
|
|
|
|
| solid_float_border | both | `false` | Make \|hl-FloatBorder\| have a more distinguishable background highlight. |
|
|
|
|
|
| darken_noncurrent_window | light | `false` | Make non-current window background darker than _Normal_. |
|
|
|
|
|
| lighten_noncurrent_window | dark | `false` | Make non-current window background lighter than _Normal_. |
|
|
|
|
|
| italic_comments | both | `true` | Make comments italicize. |
|
|
|
|
|
| darken_comments | light | `38` | Percentage to darken comments relative to Normal bg. |
|
|
|
|
|
| lighten_comments | dark | `38` | Percentage to lighten comments relative to Normal bg. |
|
|
|
|
|
| darken_non_text | light | `25` | Percentage to darken \|hl-NonText\| relative to Normal bg. |
|
|
|
|
|
| lighten_non_text | dark | `30` | Percentage to lighten \|hl-NonText\| relative to Normal bg. |
|
|
|
|
|
| darken_line_nr | light | `33` | Percentage to darken \|hl-LineNr\| relative to Normal bg. |
|
|
|
|
|
| lighten_line_nr | dark | `35` | Percentage to lighten \|hl-LineNr\| relative to Normal bg. |
|
|
|
|
|
| darken_cursor_line | light | `3` | Percentage to darken \|hl-CursorLine\| relative to Normal bg. |
|
|
|
|
|
| lighten_cursor_line | dark | `4` | Percentage to lighten \|hl-CursorLine\| relative to Normal bg. |
|
|
|
|
|
| transparent_background | both | `false` | Make background transparent. |
|
2021-10-26 17:33:01 +08:00
|
|
|
|
2021-10-10 19:23:08 +08:00
|
|
|
#### g:zenbones_compat
|
|
|
|
|
|
2021-10-30 14:33:34 +08:00
|
|
|
Set to `1` to enable compatibility mode. Enable in vim.
|
2021-10-10 19:23:08 +08:00
|
|
|
|
2021-10-28 17:10:34 +08:00
|
|
|
### lightline
|
2021-10-01 07:41:03 +08:00
|
|
|
|
|
|
|
|
```vim
|
2021-11-01 17:06:22 +08:00
|
|
|
let g:lightline = #{ colorscheme: 'zenbones' }
|
2021-10-01 07:41:03 +08:00
|
|
|
```
|
|
|
|
|
|
2021-10-28 17:10:34 +08:00
|
|
|
### lualine
|
2021-10-01 07:41:03 +08:00
|
|
|
|
|
|
|
|
```lua
|
2021-10-28 17:10:34 +08:00
|
|
|
require("lualine").setup {
|
2021-11-01 09:06:57 +00:00
|
|
|
options = { theme = "zenbones" },
|
2021-10-28 17:10:34 +08:00
|
|
|
}
|
2021-10-01 07:41:03 +08:00
|
|
|
```
|
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
|
2021-11-01 17:06:22 +08:00
|
|
|
local theme = require "zenbones"
|
2021-09-18 16:07:20 +08:00
|
|
|
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`:
|
2021-10-10 15:08:55 +08:00
|
|
|
|
|
|
|
|
```lua
|
2021-10-28 19:08:37 +08:00
|
|
|
local lush = require "lush"
|
|
|
|
|
local base = require "zenbones"
|
|
|
|
|
|
|
|
|
|
-- Create some specs
|
|
|
|
|
local specs = lush.parse(function()
|
|
|
|
|
return {
|
|
|
|
|
TabLine { base.TabLine, gui = "italic" }, -- setting gui to "italic"
|
|
|
|
|
}
|
|
|
|
|
end)
|
|
|
|
|
-- Apply specs using lush tool-chain
|
|
|
|
|
lush.apply(lush.compile(specs))
|
2021-10-10 15:08:55 +08:00
|
|
|
```
|
|
|
|
|
|
2021-10-11 11:18:09 +08:00
|
|
|
And then somewhere in your `init.vim`:
|
2021-10-10 15:08:55 +08:00
|
|
|
|
|
|
|
|
```vim
|
2021-10-28 19:08:37 +08:00
|
|
|
autocmd ColorScheme zenbones lua require "customize_zenbones"
|
2021-10-28 19:19:46 +08:00
|
|
|
colorscheme zenbones
|
2021-10-10 15:08:55 +08:00
|
|
|
```
|
|
|
|
|
|
2021-09-18 16:07:20 +08:00
|
|
|
See also
|
|
|
|
|
[Lush's documentation](https://github.com/rktjmp/lush.nvim#advanced-usage) for
|
|
|
|
|
more options.
|
2021-09-22 18:21:42 +08:00
|
|
|
|
|
|
|
|
### Create your own colorscheme
|
|
|
|
|
|
2021-10-27 17:14:39 +08:00
|
|
|
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
|
2021-09-22 18:21:42 +08:00
|
|
|
`gruvbones`.
|
|
|
|
|
|
|
|
|
|
Let's define our
|
|
|
|
|
[colorscheme](https://neovim.io/doc/user/syntax.html#:colorscheme) in
|
2021-10-21 06:34:21 +08:00
|
|
|
`colors/gruvbones.lua`. It contains the following:
|
2021-09-22 18:21:42 +08:00
|
|
|
|
|
|
|
|
```lua
|
2021-10-21 06:34:21 +08:00
|
|
|
local colors_name = "gruvbones"
|
|
|
|
|
vim.g.colors_name = colors_name -- Required when defining a colorscheme
|
2021-09-22 18:21:42 +08:00
|
|
|
|
|
|
|
|
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"
|
|
|
|
|
|
2021-10-11 14:38:05 +08:00
|
|
|
local bg = vim.opt.background:get()
|
2021-09-22 18:21:42 +08:00
|
|
|
|
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
|
2021-10-11 14:38:05 +08:00
|
|
|
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",
|
2021-10-21 06:34:21 +08:00
|
|
|
}, bg)
|
2021-09-22 18:21:42 +08:00
|
|
|
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",
|
2021-10-21 06:34:21 +08:00
|
|
|
}, bg)
|
2021-09-22 18:21:42 +08:00
|
|
|
end
|
|
|
|
|
|
2021-10-11 11:18:09 +08:00
|
|
|
-- Generate the lush specs using the generator util
|
2021-10-11 14:38:05 +08:00
|
|
|
local generator = require "zenbones.specs"
|
2021-10-21 06:34:21 +08:00
|
|
|
local base_specs = generator.generate(palette, bg, generator.get_global_config(colors_name, bg))
|
2021-09-22 18:21:42 +08:00
|
|
|
|
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()
|
2021-09-22 18:21:42 +08:00
|
|
|
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" },
|
2021-09-22 18:21:42 +08:00
|
|
|
}
|
|
|
|
|
end)
|
|
|
|
|
|
2021-10-11 11:18:09 +08:00
|
|
|
-- Pass the specs to lush to apply
|
2021-09-22 18:21:42 +08:00
|
|
|
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)
|
2021-09-22 18:21:42 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
And there you have it. Just call `colorscheme gruvbones` to use your new
|
|
|
|
|
colorscheme. It respects `&background` and other configurations too.
|
|
|
|
|
|
2021-10-10 15:08:55 +08:00
|
|
|
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.
|