1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 12:50:04 +08:00

Fix statusline theme (#2170)

This commit is contained in:
Wang Shidong 2018-09-16 13:05:35 +08:00 committed by GitHub
parent feaaad3b31
commit 4c32447783
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 90 additions and 22 deletions

6
.projections.json Normal file
View File

@ -0,0 +1,6 @@
{
"docs/*.md": {"alternate": "docs/cn/{}.md"},
"docs/cn/*.md": {"alternate": "docs/{}.md"},
"doc/*.txt": {"alternate": "doc/{}.cnx"},
"doc/*.cnx": {"alternate": "doc/{}.txt"},
}

View File

@ -18,5 +18,7 @@ function! SpaceVim#mapping#guide#theme#SpaceVim#palette() abort
\ ['#282828', '#00BFFF', 114, 152], \ ['#282828', '#00BFFF', 114, 152],
\ ['#2c323c', '#ff8787', 114, 210], \ ['#2c323c', '#ff8787', 114, 210],
\ ['#2c323c', '#d75f5f', 114, 167], \ ['#2c323c', '#d75f5f', 114, 167],
\ ['#282828', '#689d6a', 235, 72],
\ ['#282828', '#8f3f71', 235, 132],
\ ] \ ]
endfunction endfunction

View File

@ -15,5 +15,7 @@ function! SpaceVim#mapping#guide#theme#molokai#palette() abort
\ ['#282828', '#8787af', 235, 103], \ ['#282828', '#8787af', 235, 103],
\ ['#282828', '#ffd700', 235, 220], \ ['#282828', '#ffd700', 235, 220],
\ ['#282828', '#ff5f5f', 235, 203], \ ['#282828', '#ff5f5f', 235, 203],
\ ['#282828', '#689d6a', 235, 72],
\ ['#282828', '#8f3f71', 235, 132],
\ ] \ ]
endfunction endfunction

View File

@ -16,5 +16,7 @@ function! SpaceVim#mapping#guide#theme#onedark#palette() abort
\ ['#282c34', '#00af87', 235, 36], \ ['#282c34', '#00af87', 235, 36],
\ ['#282c34', '#ff8700', 235, 208], \ ['#282c34', '#ff8700', 235, 208],
\ ['#282c34', '#af5f5f', 235, 131], \ ['#282c34', '#af5f5f', 235, 131],
\ ['#282828', '#689d6a', 235, 72],
\ ['#282828', '#8f3f71', 235, 132],
\ ] \ ]
endfunction endfunction

View File

@ -69,6 +69,8 @@ function! SpaceVim#mapping#guide#theme#solarized#palette() abort
\ [s:gui_base03, s:gui_blue, s:cterm_base03, s:cterm_blue], \ [s:gui_base03, s:gui_blue, s:cterm_base03, s:cterm_blue],
\ [s:gui_base03, s:gui_orange, s:cterm_base03, s:cterm_orange], \ [s:gui_base03, s:gui_orange, s:cterm_base03, s:cterm_orange],
\ [s:gui_base03, s:gui_cyan, s:cterm_base03, s:cterm_cyan], \ [s:gui_base03, s:gui_cyan, s:cterm_base03, s:cterm_cyan],
\ ['#282828', '#689d6a', 235, 72],
\ ['#282828', '#8f3f71', 235, 132],
\ ] \ ]
else else
return [ return [
@ -79,6 +81,8 @@ function! SpaceVim#mapping#guide#theme#solarized#palette() abort
\ [s:gui_base3, s:gui_blue, s:cterm_base3, s:cterm_blue], \ [s:gui_base3, s:gui_blue, s:cterm_base3, s:cterm_blue],
\ [s:gui_base3, s:gui_orange, s:cterm_base3, s:cterm_orange], \ [s:gui_base3, s:gui_orange, s:cterm_base3, s:cterm_orange],
\ [s:gui_base3, s:gui_cyan, s:cterm_base3, s:cterm_cyan], \ [s:gui_base3, s:gui_cyan, s:cterm_base3, s:cterm_cyan],
\ ['#282828', '#689d6a', 235, 72],
\ ['#282828', '#8f3f71', 235, 132],
\ ] \ ]
endif endif
endfunction endfunction

View File

@ -500,8 +500,10 @@ SpaceVim 所支持的分割符以及截图如下:
**状态栏的颜色** **状态栏的颜色**
当前版本的状态栏支持 `gruvbox`/`molokai`/`nord`/`one`/`onedark`,如果你需要使用其他主题, SpaceVim 默认为 [colorcheme 模块](../layers/colorscheme/)所包含的主题颜色提供了状态栏主题,若需要使用其他颜色主题,
可以通过以下模板来设置: 需要自行设置状态栏主题。若未设置,则使用 gruvbox 的主题。
可以参考以下模板来设置:
```vim ```vim
" the theme colors should be " the theme colors should be

View File

@ -39,19 +39,37 @@ colorscheme 模块为 SpaceVim 提供了一系列常用的颜色主题,默认
**主题列表** **主题列表**
| 名称 | 深色主题 | 浅色主题 | 终端支持 | Gui支持 | 状态栏支持 | | 名称 | 深色主题 | 浅色主题 | 终端支持 | Gui支持 | 状态栏支持 |
| ---------- | -------- | -------- | -------- | ------- | ---------- | | ------------ | -------- | -------- | -------- | ------- | ---------- |
| gruvbox | yes | yes | yes | yes | yes | | molokai | yes | no | yes | yes | yes |
| one | yes | yes | yes | yes | yes | | onedark | yes | no | yes | yes | yes |
| molokai | yes | no | yes | yes | yes | | jellybeans | yes | no | yes | yes | yes |
| jellybeans | yes | no | yes | yes | yes | | one | yes | yes | yes | yes | yes |
| nord | yes | no | yes | yes | yes | | nord | yes | no | yes | yes | yes |
| onedark | 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` 来添加主题,例如:
```toml
[options]
colorscheme = "OceanicNext"
colorscheme_bg = "dark"
# 添加自定义主题https://github.com/mhartington/oceanic-next
[[custom_plugins]]
name = "mhartington/oceanic-next"
merged = 0
```
部分主题提供了深色和浅色两系列的主题,可以通过设置主题背景色来切换这两种主题。 部分主题提供了深色和浅色两系列的主题,可以通过设置主题背景色来切换这两种主题。
SpaceVim 支持在配置文件中通过 `colorscheme_bg` 这一选项来设置。 SpaceVim 支持在配置文件中通过 `colorscheme_bg` 这一选项来设置。
比如,设置默认主题为 onedark并且使用其深色系列主题 比如,设置默认主题为 onedark并且使用其深色系列主题
```toml ```toml

View File

@ -521,8 +521,10 @@ The letters displayed in the statusline correspond to the key bindings used to t
**colorscheme of statusline:** **colorscheme of statusline:**
current version only support `gruvbox`/`molokai`/`nord`/`one`/`onedark`, if you want to By default SpaceVim only support colorschemes which has
contribute theme please check the template of a statusline theme. been included in [colorscheme layer](../layers/colorscheme/).
If you want to contribute theme please check the template of a statusline theme.
```vim ```vim
" the theme colors should be " the theme colors should be

View File

@ -37,16 +37,35 @@ To change the colorscheme:
colorscheme = "onedark" colorscheme = "onedark"
``` ```
**List colorschemes** Colorscheme list
| Name | dark | light | term | gui | statusline |
| ------------ | ---- | ----- | ---- | --- | ---------- |
| 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 |
By default this layer only include above colorschemes, if you want to use other colorscheme which
is available on github, you can use `custom_plugins` section in configuration file, for examples:
```toml
[options]
colorscheme = "OceanicNext"
colorscheme_bg = "dark"
# add custom_plugins: https://github.com/mhartington/oceanic-next
[[custom_plugins]]
name = "mhartington/oceanic-next"
merged = 0
```
| Name | dark | light | term | gui | statusline |
| ---------- | ---- | ----- | ---- | --- | ---------- |
| gruvbox | yes | yes | yes | yes | yes |
| one | yes | yes | yes | yes | yes |
| molokai | yes | no | yes | yes | yes |
| jellybeans | yes | no | yes | yes | yes |
| nord | yes | no | yes | yes | yes |
| onedark | yes | no | yes | yes | yes |
Some colorschemes offer dark and light styles. Most of them are set by changing 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 Vim background color. SpaceVim support to change the background color with
@ -65,3 +84,4 @@ colorscheme layer support random colorscheme on startup. just load this layer wi
name = "colorscheme" name = "colorscheme"
random-theme = true random-theme = true
``` ```

View File

@ -1,3 +1,5 @@
Execute ( SpaceVim colorscheme ): Execute ( SpaceVim colorscheme ):
let g:current_colors = g:colors_name
colorscheme SpaceVim colorscheme SpaceVim
AssertEqual g:colors_name, 'SpaceVim' AssertEqual g:colors_name, 'SpaceVim'
exe 'colorscheme ' . g:current_colors

7
test/color/theme.vader Normal file
View File

@ -0,0 +1,7 @@
Execute ( SpaceVim statusline theme ):
let g:_spacevim_built_in_themes = map(split(globpath('.', 'autoload/SpaceVim/mapping/guide/theme/*.vim'), "\n"), 'fnamemodify(v:val, ":t:r")')
for theme in g:_spacevim_built_in_themes
Log 'testing theme: ' . theme
AssertEqual len(call('SpaceVim#mapping#guide#theme#' . theme . '#palette', [])), 9
endfor

View File

@ -81,6 +81,7 @@ The next release is v0.9.0.
- Fix python autoflake support ([#2115](https://github.com/SpaceVim/SpaceVim/pull/2115)) - Fix python autoflake support ([#2115](https://github.com/SpaceVim/SpaceVim/pull/2115))
- Fix active statusline displaying fileformat info ([#2125](https://github.com/SpaceVim/SpaceVim/pull/2125)) - Fix active statusline displaying fileformat info ([#2125](https://github.com/SpaceVim/SpaceVim/pull/2125))
- Fix unkown v:progpath ([#2169](https://github.com/SpaceVim/SpaceVim/pull/2169)) - Fix unkown v:progpath ([#2169](https://github.com/SpaceVim/SpaceVim/pull/2169))
- Fix builtin statusline theme ([#2170](https://github.com/SpaceVim/SpaceVim/pull/2170))
### Removed ### Removed