From 54575d6f7679812ab4922d19d0719dafb8d32535 Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Sun, 28 Apr 2019 21:19:09 +0800 Subject: [PATCH] Add srcery colorscheme (#2526) --- autoload/SpaceVim/autocmds.vim | 8 ++- autoload/SpaceVim/layers/colorscheme.vim | 2 + .../SpaceVim/mapping/guide/theme/srcery.vim | 64 +++++++++++++++++++ docs/cn/layers/colorscheme.md | 30 ++++----- docs/layers/colorscheme.md | 6 +- 5 files changed, 88 insertions(+), 22 deletions(-) create mode 100644 autoload/SpaceVim/mapping/guide/theme/srcery.vim diff --git a/autoload/SpaceVim/autocmds.vim b/autoload/SpaceVim/autocmds.vim index d31df1d73..907b3de66 100644 --- a/autoload/SpaceVim/autocmds.vim +++ b/autoload/SpaceVim/autocmds.vim @@ -62,7 +62,7 @@ function! SpaceVim#autocmds#init() abort autocmd BufWritePre * call SpaceVim#plugins#mkdir#CreateCurrent() autocmd BufWritePost *.vim call s:generate_doc() autocmd ColorScheme * call SpaceVim#api#import('vim#highlight').hide_in_normal('EndOfBuffer') - autocmd ColorScheme gruvbox,jellybeans,nord call s:fix_VertSplit() + autocmd ColorScheme gruvbox,jellybeans,nord,srcery call s:fix_colorschem_in_SpaceVim() autocmd VimEnter * call SpaceVim#autocmds#VimEnter() autocmd BufEnter * let b:_spacevim_project_name = get(g:, '_spacevim_project_name', '') autocmd SessionLoadPost * let g:_spacevim_session_loaded = 1 @@ -117,7 +117,7 @@ function! s:generate_doc() abort endif endfunction -function! s:fix_VertSplit() abort +function! s:fix_colorschem_in_SpaceVim() abort if &background ==# 'dark' if g:colors_name ==# 'gruvbox' hi VertSplit guibg=#282828 guifg=#181A1F @@ -125,6 +125,10 @@ function! s:fix_VertSplit() abort hi VertSplit guibg=#151515 guifg=#080808 elseif g:colors_name ==# 'nord' hi VertSplit guibg=#2E3440 guifg=#262626 + elseif g:colors_name ==# 'srcery' + hi VertSplit guibg=#1C1B19 guifg=#262626 + hi clear Visual + hi Visual guibg=#303030 endif else if g:colors_name ==# 'gruvbox' diff --git a/autoload/SpaceVim/layers/colorscheme.vim b/autoload/SpaceVim/layers/colorscheme.vim index 276c9e2ae..b6d516a44 100644 --- a/autoload/SpaceVim/layers/colorscheme.vim +++ b/autoload/SpaceVim/layers/colorscheme.vim @@ -37,6 +37,7 @@ function! SpaceVim#layers#colorscheme#plugins() abort \ ['icymind/NeoSolarized', { 'merged' : 0 }], \ ['w0ng/vim-hybrid', { 'merged' : 0 }], \ ['SpaceVim/vim-material', { 'merged' : 0}], + \ ['srcery-colors/srcery-vim', { 'merged' : 0}], \ ] " " TODO: @@ -59,6 +60,7 @@ let s:cs = [ \ 'hybrid', \ 'NeoSolarized', \ 'material', + \ 'srcery', \ ] let s:NUMBER = SpaceVim#api#import('data#number') diff --git a/autoload/SpaceVim/mapping/guide/theme/srcery.vim b/autoload/SpaceVim/mapping/guide/theme/srcery.vim new file mode 100644 index 000000000..796e87d8c --- /dev/null +++ b/autoload/SpaceVim/mapping/guide/theme/srcery.vim @@ -0,0 +1,64 @@ +" Color Palette {{{ + +let s:black = [ '#1c1b19', 0 ] +let s:red = [ '#ef2f27', 1 ] +let s:green = [ '#519f50', 2 ] +let s:yellow = [ '#fbb829', 3 ] +let s:blue = [ '#2c78bf', 4 ] +let s:magenta = [ '#e02c6d', 5 ] +let s:cyan = [ '#0aaeb3', 6 ] +let s:white = [ '#918175', 7 ] +let s:bright_black = [ '#2d2c29', 8 ] +let s:bright_red = [ '#f75341', 9 ] +let s:bright_green = [ '#98bc37', 10 ] +let s:bright_yellow = [ '#fed06e', 11 ] +let s:bright_blue = [ '#68a8e4', 12 ] +let s:bright_magenta = [ '#ff5c8f', 13 ] +let s:bright_cyan = [ '#53fde9', 14 ] +let s:bright_white = [ '#fce8c3', 15 ] + +" xterm Colors +let s:orange = [ '#d75f00', 166 ] +let s:bright_orange = [ '#ff8700', 208 ] +let s:hard_black = [ '#121212', 233 ] +let s:xgray1 = [ '#262626', 235 ] +let s:xgray2 = [ '#303030', 236 ] +let s:xgray3 = [ '#3a3a3a', 237 ] +let s:xgray4 = [ '#444444', 238 ] +let s:xgray5 = [ '#4e4e4e', 239 ] + +" }}} + +" the theme colors should be +" [ +" \ [ a_guifg, a_guibg, a_ctermfg, a_ctermbg], +" \ [ b_guifg, b_guibg, b_ctermfg, b_ctermbg], +" \ [ c_guifg, c_guibg, c_ctermfg, c_ctermbg], +" \ [ z_guibg, z_ctermbg], +" \ [ i_guifg, i_guibg, i_ctermfg, i_ctermbg], +" \ [ v_guifg, v_guibg, v_ctermfg, v_ctermbg], +" \ [ r_guifg, r_guibg, r_ctermfg, r_ctermbg], +" \ [ ii_guifg, ii_guibg, ii_ctermfg, ii_ctermbg], +" \ [ in_guifg, in_guibg, in_ctermfg, in_ctermbg], +" \ ] +" group_a: window id +" group_b/group_c: stausline sections +" group_z: empty area +" group_i: window id in insert mode +" group_v: window id in visual mode +" group_r: window id in select mode +" group_ii: window id in iedit-insert mode +" group_in: windows id in iedit-normal mode +function! SpaceVim#mapping#guide#theme#srcery#palette() abort + return [ + \ ['#282828', '#fce8c3', 246, 15], + \ ['#a89984', '#2d2c29', 239, 8], + \ ['#a89984', '#3c3836', 237, 246], + \ ['#665c54', 241], + \ ['#282828', '#83a598', 235, 109], + \ ['#282828', '#0aaeb3', 235, 6], + \ ['#282828', '#8ec07c', 235, 108], + \ ['#282828', '#689d6a', 235, 72], + \ ['#282828', '#8f3f71', 235, 132], + \ ] +endfunction diff --git a/docs/cn/layers/colorscheme.md b/docs/cn/layers/colorscheme.md index bc938ec12..5b7369367 100644 --- a/docs/cn/layers/colorscheme.md +++ b/docs/cn/layers/colorscheme.md @@ -1,5 +1,4 @@ --- - title: "SpaceVim colorscheme 模块" description: "这一模块为 SpaceVim 提供了一系列的常用颜色主题,默认情况下使用深色 gruvbox 作为默认主题。该模块提供了快速切换主题、随机主题等特性。" lang: cn @@ -40,18 +39,19 @@ colorscheme 模块为 SpaceVim 提供了一系列常用的颜色主题,默认 **主题列表** -| 名称 | 深色主题 | 浅色主题 | 终端支持 | Gui支持 | 状态栏支持 | -| ------------ | -------- | -------- | -------- | ------- | ---------- | -| molokai | yes | no | yes | yes | yes | -| onedark | yes | no | yes | yes | yes | -| jellybeans | yes | no | yes | yes | yes | -| one | yes | yes | yes | yes | yes | -| nord | yes | no | yes | yes | yes | -| gruvbox | yes | yes | yes | yes | yes | -| NeoSolarized | yes | yes | yes | yes | yes | -| hybrid | yes | yes | yes | yes | yes | -| material | yes | yes | yes | yes | yes | -| SpaceVim | yes | yes | yes | yes | yes | +| 名称 | 深色主题 | 浅色主题 | 终端支持 | Gui 支持 | 状态栏支持 | +| ------------ | -------- | -------- | -------- | -------- | ---------- | +| molokai | yes | no | yes | yes | yes | +| srcery | yes | no | yes | yes | yes | +| onedark | yes | no | yes | yes | yes | +| jellybeans | yes | no | yes | yes | yes | +| one | yes | yes | yes | yes | yes | +| nord | yes | no | yes | yes | yes | +| gruvbox | yes | yes | yes | yes | yes | +| NeoSolarized | yes | yes | yes | yes | yes | +| hybrid | yes | yes | yes | yes | yes | +| material | yes | yes | yes | yes | yes | +| SpaceVim | yes | yes | yes | yes | yes | 默认情况下,SpaceVim 的 colorscheme 模块仅包含以上主题,如果需要使用 Github 上其它主题, 可以在配置文件中使用 `custom_plugins` 来添加主题,例如: @@ -67,7 +67,6 @@ colorscheme 模块为 SpaceVim 提供了一系列常用的颜色主题,默认 merged = 0 ``` - 部分主题提供了深色和浅色两系列的主题,可以通过设置主题背景色来切换这两种主题。 SpaceVim 支持在配置文件中通过 `colorscheme_bg` 这一选项来设置。 @@ -89,7 +88,7 @@ SpaceVim 支持在配置文件中通过 `colorscheme_bg` 这一选项来设置 ``` 除了在每次启用时自动应用随机主题以外,也可以设置它的更新频率,默认是为空, -表示每次启用 Vim 是随机选择一种主题。可供选择的频率有:`daily`、`hourly`、`weekly`, +表示每次启用 Vim 是随机选择一种主题。可供选择的频率有:`daily`、`hourly`、`weekly`, 以及 `数字 + 单位` 这种格式,如 `1h`。 ```toml @@ -98,4 +97,3 @@ SpaceVim 支持在配置文件中通过 `colorscheme_bg` 这一选项来设置 random_theme = true frequency = "daily" ``` - diff --git a/docs/layers/colorscheme.md b/docs/layers/colorscheme.md index 0a51f5495..d5fbc43ba 100644 --- a/docs/layers/colorscheme.md +++ b/docs/layers/colorscheme.md @@ -42,6 +42,7 @@ Colorscheme list | Name | dark | light | term | gui | statusline | | ------------ | ---- | ----- | ---- | --- | ---------- | | molokai | yes | no | yes | yes | yes | +| srcery | yes | no | yes | yes | yes | | onedark | yes | no | yes | yes | yes | | jellybeans | yes | no | yes | yes | yes | | one | yes | yes | yes | yes | yes | @@ -66,7 +67,6 @@ are available on Github, use the `custom_plugins` section in configuration file. merged = 0 ``` - Some colorschemes offer dark and light styles. Most of them are set by changing Vim background color. SpaceVim support to change the background color with `colorscheme_bg`: @@ -85,7 +85,7 @@ Colorscheme layer support random colorscheme on startup. just load this layer wi random_theme = true ``` -The frequency can be changed via `frequency` layer options, the available values are `daily`, `hourly`, `weekly`. +The frequency can be changed via `frequency` layer options, the available values are `daily`, `hourly`, `weekly`. You can also use `number + unit`, for example: `1h`. ```toml @@ -94,5 +94,3 @@ You can also use `number + unit`, for example: `1h`. random_theme = true frequency = "daily" ``` - -