improve themes
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
let g:vim_version = matchstr(execute('version'), 'NVIM v\zs[^\n]*')
|
let g:vim_version = matchstr(execute('version'), 'NVIM v\zs[^\n]*')
|
||||||
else
|
else
|
||||||
let g:vim_type = 'vim'
|
let g:vim_type = 'vim'
|
||||||
let g:vim_version = matchstr(execute('version'), 'NVIM v\zs[^\n]*')
|
let g:vim_version = matchstr(execute('version'), 'Vi IMproved \zs[^\n]*')
|
||||||
endif
|
endif
|
||||||
let g:vim_version = str2float(g:vim_version)
|
let g:vim_version = str2float(g:vim_version)
|
||||||
let g:dotfile_path = '~/.dotfiles/'
|
let g:dotfile_path = '~/.dotfiles/'
|
||||||
|
|||||||
+33
-24
@@ -321,9 +321,9 @@ endif
|
|||||||
|
|
||||||
" dark or light
|
" dark or light
|
||||||
if filereadable(expand(g:vim_dir . '.light_theme.signal'))
|
if filereadable(expand(g:vim_dir . '.light_theme.signal'))
|
||||||
let g:theme_color = 'light'
|
let g:dark_or_white_theme = 'light'
|
||||||
else
|
else
|
||||||
let g:theme_color = 'dark'
|
let g:dark_or_white_theme = 'dark'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" what to use for dark theme
|
" what to use for dark theme
|
||||||
@@ -350,20 +350,20 @@ endif
|
|||||||
set background=dark
|
set background=dark
|
||||||
hi clear
|
hi clear
|
||||||
execute("colorscheme " . g:dark_theme)
|
execute("colorscheme " . g:dark_theme)
|
||||||
let g:theme_color = 'dark'
|
let g:dark_or_white_theme = 'dark'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SetLightTheme()
|
function! SetLightTheme()
|
||||||
set background=light
|
set background=light
|
||||||
hi clear
|
hi clear
|
||||||
execute("colorscheme " . g:light_theme)
|
execute("colorscheme " . g:light_theme)
|
||||||
let g:theme_color = 'light'
|
let g:dark_or_white_theme = 'light'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Change bottom airline/lualine theme
|
" Change bottom airline/lualine theme
|
||||||
" Currently only support airline
|
" Currently only support airline
|
||||||
function! SetAirlineTheme(theme)
|
function! SetAirlineTheme(theme)
|
||||||
if has('nvim') && g:vim_version >= 0.5
|
if g:vim_type == 'nvim' && g:vim_version >= 0.5
|
||||||
execute('AirlineTheme ' . a:theme)
|
execute('AirlineTheme ' . a:theme)
|
||||||
else
|
else
|
||||||
execute('AirlineTheme ' . a:theme)
|
execute('AirlineTheme ' . a:theme)
|
||||||
@@ -375,6 +375,7 @@ endif
|
|||||||
function! TransparentBackgroundFix()
|
function! TransparentBackgroundFix()
|
||||||
"if !has('nvim') || g:vim_version < 0.5
|
"if !has('nvim') || g:vim_version < 0.5
|
||||||
if v:true
|
if v:true
|
||||||
|
"if v:false
|
||||||
highlight SignColumn ctermbg=none
|
highlight SignColumn ctermbg=none
|
||||||
"highlight CursorLineNr ctermbg=none
|
"highlight CursorLineNr ctermbg=none
|
||||||
highlight CocWarningHighlight ctermbg=none
|
highlight CocWarningHighlight ctermbg=none
|
||||||
@@ -385,7 +386,7 @@ endif
|
|||||||
highlight CocWarningSign ctermbg=none
|
highlight CocWarningSign ctermbg=none
|
||||||
highlight CocInfoSign ctermbg=none
|
highlight CocInfoSign ctermbg=none
|
||||||
highlight CocHintSign ctermbg=none
|
highlight CocHintSign ctermbg=none
|
||||||
if g:theme_color == 'dark'
|
if g:dark_or_white_theme == 'dark'
|
||||||
highlight! link TempColor Visual
|
highlight! link TempColor Visual
|
||||||
highlight! link CocFloating TempColor
|
highlight! link CocFloating TempColor
|
||||||
highlight! link CocErrorFloat TempColor
|
highlight! link CocErrorFloat TempColor
|
||||||
@@ -399,7 +400,7 @@ endif
|
|||||||
function! EnableTransparent()
|
function! EnableTransparent()
|
||||||
if g:vim_type == 'nvim' && g:vim_version > 0.5
|
if g:vim_type == 'nvim' && g:vim_version > 0.5
|
||||||
:TransparentEnable
|
:TransparentEnable
|
||||||
elseif g:theme_color == 'dark'
|
elseif g:dark_or_white_theme == 'dark'
|
||||||
let g:PaperColor_Theme_Options = {
|
let g:PaperColor_Theme_Options = {
|
||||||
\ 'theme': {
|
\ 'theme': {
|
||||||
\ 'default.dark': {
|
\ 'default.dark': {
|
||||||
@@ -408,7 +409,7 @@ endif
|
|||||||
\ }
|
\ }
|
||||||
\ }
|
\ }
|
||||||
execute("colorscheme " . g:dark_theme)
|
execute("colorscheme " . g:dark_theme)
|
||||||
elseif g:theme_color == 'light'
|
elseif g:dark_or_white_theme == 'light'
|
||||||
let g:PaperColor_Theme_Options = {
|
let g:PaperColor_Theme_Options = {
|
||||||
\ 'theme': {
|
\ 'theme': {
|
||||||
\ 'default.light': {
|
\ 'default.light': {
|
||||||
@@ -423,7 +424,7 @@ endif
|
|||||||
function! DisableTransparent()
|
function! DisableTransparent()
|
||||||
if g:vim_type == 'nvim' && g:vim_version > 0.5
|
if g:vim_type == 'nvim' && g:vim_version > 0.5
|
||||||
:TransparentDisable
|
:TransparentDisable
|
||||||
elseif g:theme_color == 'dark'
|
elseif g:dark_or_white_theme == 'dark'
|
||||||
let g:PaperColor_Theme_Options = {
|
let g:PaperColor_Theme_Options = {
|
||||||
\ 'theme': {
|
\ 'theme': {
|
||||||
\ 'default.dark': {
|
\ 'default.dark': {
|
||||||
@@ -432,7 +433,7 @@ endif
|
|||||||
\ }
|
\ }
|
||||||
\ }
|
\ }
|
||||||
execute("colorscheme " . g:dark_theme)
|
execute("colorscheme " . g:dark_theme)
|
||||||
elseif g:theme_color == 'light'
|
elseif g:dark_or_white_theme == 'light'
|
||||||
let g:PaperColor_Theme_Options = {
|
let g:PaperColor_Theme_Options = {
|
||||||
\ 'theme': {
|
\ 'theme': {
|
||||||
\ 'default.light': {
|
\ 'default.light': {
|
||||||
@@ -459,17 +460,17 @@ endif
|
|||||||
" ToggleTransparent background
|
" ToggleTransparent background
|
||||||
" only works in dark theme
|
" only works in dark theme
|
||||||
function! ToggleTransparent()
|
function! ToggleTransparent()
|
||||||
if g:transparent_dark_theme && g:theme_color == 'dark'
|
if g:transparent_dark_theme && g:dark_or_white_theme == 'dark'
|
||||||
call DisableTransparent()
|
call DisableTransparent()
|
||||||
let g:transparent_dark_theme = v:false
|
let g:transparent_dark_theme = v:false
|
||||||
call DeleteSignalFile('.transparent_dark_theme.signal')
|
call DeleteSignalFile('.transparent_dark_theme.signal')
|
||||||
elseif g:transparent_light_theme && g:theme_color == 'light'
|
elseif g:transparent_light_theme && g:dark_or_white_theme == 'light'
|
||||||
call DisableTransparent()
|
call DisableTransparent()
|
||||||
let g:transparent_light_theme = v:false
|
let g:transparent_light_theme = v:false
|
||||||
call DeleteSignalFile('.transparent_light_theme.signal')
|
call DeleteSignalFile('.transparent_light_theme.signal')
|
||||||
else
|
else
|
||||||
call EnableTransparent()
|
call EnableTransparent()
|
||||||
if g:theme_color == 'dark'
|
if g:dark_or_white_theme == 'dark'
|
||||||
let g:transparent_dark_theme = v:true
|
let g:transparent_dark_theme = v:true
|
||||||
call CreateSignalFile('.transparent_dark_theme.signal')
|
call CreateSignalFile('.transparent_dark_theme.signal')
|
||||||
else
|
else
|
||||||
@@ -482,22 +483,30 @@ endif
|
|||||||
|
|
||||||
|
|
||||||
" vim theme
|
" vim theme
|
||||||
if isdirectory(expand(plugin_dir . "/papercolor-theme"))
|
if !has('nvim') && isdirectory(expand(plugin_dir . "/papercolor-theme"))
|
||||||
" improve coc color in this theme
|
set t_Co=256
|
||||||
let g:light_theme = 'PaperColor'
|
" improve coc color in this theme
|
||||||
let g:dark_theme = 'PaperColor'
|
let g:light_theme = 'PaperColor'
|
||||||
endif
|
let g:dark_theme = 'PaperColor'
|
||||||
|
"let g:airline_dark_theme = "papercolor"
|
||||||
|
"let g:airline_light_theme = "papercolor"
|
||||||
|
endif
|
||||||
|
|
||||||
" nvim only theme
|
" nvim only theme
|
||||||
if isdirectory(expand(plugin_dir . "/nightfox.nvim")) && isdirectory(expand(plugin_dir . "/github-nvim-theme")) && has('nvim') && g:vim_version >= 0.5
|
if has('nvim')
|
||||||
|
if g:vim_version >= 0.8 && isdirectory(expand(plugin_dir . "/nightfox.nvim"))
|
||||||
let g:light_theme = 'dawnfox'
|
let g:light_theme = 'dawnfox'
|
||||||
"let g:dark_theme = 'nightfox'
|
"let g:dark_theme = 'nightfox'
|
||||||
|
end
|
||||||
|
|
||||||
|
if g:vim_version >= 0.5 && isdirectory(expand(plugin_dir . "/github-nvim-theme"))
|
||||||
let g:dark_theme = 'github_dark'
|
let g:dark_theme = 'github_dark'
|
||||||
let g:airline_dark_theme = "hybrid"
|
let g:airline_dark_theme = "hybrid"
|
||||||
endif
|
end
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
if g:theme_color == 'dark'
|
if g:dark_or_white_theme == 'dark'
|
||||||
let g:airline_theme=g:airline_dark_theme
|
let g:airline_theme=g:airline_dark_theme
|
||||||
call SetDarkTheme()
|
call SetDarkTheme()
|
||||||
else
|
else
|
||||||
@@ -507,7 +516,7 @@ endif
|
|||||||
|
|
||||||
" Since in .vimrc we cannot call plugin function as they
|
" Since in .vimrc we cannot call plugin function as they
|
||||||
" are not loaded (:help startup)
|
" are not loaded (:help startup)
|
||||||
if g:transparent_dark_theme && g:theme_color == 'dark' || g:transparent_light_theme && g:theme_color == 'light'
|
if g:transparent_dark_theme && g:dark_or_white_theme == 'dark' || g:transparent_light_theme && g:dark_or_white_theme == 'light'
|
||||||
if g:vim_type == 'nvim' && g:vim_version > 0.5
|
if g:vim_type == 'nvim' && g:vim_version > 0.5
|
||||||
let g:transparent_enabled = v:true
|
let g:transparent_enabled = v:true
|
||||||
else
|
else
|
||||||
@@ -525,7 +534,7 @@ endif
|
|||||||
" Allow to trigger background
|
" Allow to trigger background
|
||||||
function! ToggleBG()
|
function! ToggleBG()
|
||||||
" Inversion
|
" Inversion
|
||||||
if g:theme_color == "dark"
|
if g:dark_or_white_theme == "dark"
|
||||||
call SetLightTheme()
|
call SetLightTheme()
|
||||||
call SetAirlineTheme(g:airline_light_theme)
|
call SetAirlineTheme(g:airline_light_theme)
|
||||||
call CreateSignalFile('.light_theme.signal')
|
call CreateSignalFile('.light_theme.signal')
|
||||||
@@ -536,7 +545,7 @@ endif
|
|||||||
call DeleteSignalFile(".light_theme.signal")
|
call DeleteSignalFile(".light_theme.signal")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if g:transparent_dark_theme && g:theme_color == 'dark' || g:transparent_light_theme && g:theme_color == 'light'
|
if g:transparent_dark_theme && g:dark_or_white_theme == 'dark' || g:transparent_light_theme && g:dark_or_white_theme == 'light'
|
||||||
call EnableTransparent()
|
call EnableTransparent()
|
||||||
else
|
else
|
||||||
call DisableTransparent()
|
call DisableTransparent()
|
||||||
|
|||||||
Reference in New Issue
Block a user