• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

norcalli/nvim-base16.lua: Programmatic lua library for setting base16 themes in ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

norcalli/nvim-base16.lua

开源软件地址(OpenSource Url):

https://github.com/norcalli/nvim-base16.lua

开源编程语言(OpenSource Language):

Lua 100.0%

开源软件介绍(OpenSource Introduction):

base16.lua

Programmatic lua library for setting base16 themes in Neovim.

Demo

local theme_names = base16.theme_names()
base16_position = 1
function cycle_theme()
  base16_position = (base16_position % #theme_names) + 1
  base16(base16.themes[theme_names[base16_position]], true)
end

Cycle themes

Usage

Install via your plugin manager. e.g.

Plug "norcalli/nvim-base16.lua"

Basic usage

lua << EOF
local base16 = require 'base16'
base16(base16.themes.brewer, true)
EOF

This is how I use it. Uses norcalli/nvim.lua.

lua << EOF
nvim = require 'nvim'
local base16 = require 'base16'
base16(base16.themes[nvim.env.BASE16_THEME or "3024"], true)
EOF

You can define your own themes and use them with the base16 function as long as they match the format described below. I know the format is annoying to define, so the base16.theme_from_array utility function is available.

API

base16.apply_theme(theme_definition: dict, use_256_colorspace: bool)

base16(theme_definition: dict, use_256_colorspace: bool)

Alias for base16.apply_theme(theme_definition: dict, use_256_colorspace: bool).

Example:

base16(base16.themes["brewer"], true)

base16.theme_names() -> string

Return a list of all available theme names. Shortcut for fetching the keys from base16.themes.

Example:

print(vim.inspect(base16.theme_names()))

base16.theme_from_array(theme_definition: array) -> dict

Formats an array of 16 hex color strings into a dictionary suitable for use with base16.apply_theme.

Example:

local theme = base16.theme_from_array {
	"383838"; "404040"; "606060"; "6f6f6f";
	"808080"; "dcdccc"; "c0c0c0"; "ffffff";
	"dca3a3"; "dfaf8f"; "e0cf9f"; "5f7f5f";
	"93e0e3"; "7cb8bb"; "dc8cc3"; "000000";
}
base16(theme, true)

Variables

base16.themes

Dictionary of definitions to be used by base16 or base16.apply_theme.

Example:

base16.themes["zenburn"] == {
	base00 = "383838"; base01 = "404040"; base02 = "606060"; base03 = "6f6f6f";
	base04 = "808080"; base05 = "dcdccc"; base06 = "c0c0c0"; base07 = "ffffff";
	base08 = "dca3a3"; base09 = "dfaf8f"; base0A = "e0cf9f"; base0B = "5f7f5f";
	base0C = "93e0e3"; base0D = "7cb8bb"; base0E = "dc8cc3"; base0F = "000000";
}

Notes

Because this includes a copy of norcalli/nvim.lua, you should put this after norcalli/nvim.lua in the plugin list because lua module resolution is first-come-first-served, i.e.

Plug "norcalli/nvim.lua"
Plug "norcalli/nvim-base16.lua"

Credits

Chris Kempson and Base16 and base16-vim




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
ianmaclarty/amulet: lua game toolkit发布时间:2022-08-16
下一篇:
steve0511/resty-redis-cluster: Openresty lua client for redis cluster.发布时间:2022-08-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap