Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for truecolor Neovim and for the Neovim terminal #329

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 30 additions & 5 deletions vim-colors-solarized/colors/solarized.vim
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@
" Allow or disallow certain features based on current terminal emulator or
" environment.

" Environment has truecolor support
function s:IsTruecolor()
return has('gui_running') || (has('nvim') && $NVIM_TUI_ENABLE_TRUE_COLOR)
endfunction

" Terminals that support italics
let s:terms_italic=[
\"rxvt",
Expand Down Expand Up @@ -240,7 +245,7 @@ let colors_name = "solarized"
" leave the hex values out entirely in that case and include only cterm colors)
" We also check to see if user has set solarized (force use of the
" neutral gray monotone palette component)
if (has("gui_running") && g:solarized_degrade == 0)
if (s:IsTruecolor() && g:solarized_degrade == 0)
let s:vmode = "gui"
let s:base03 = "#002b36"
let s:base02 = "#073642"
Expand All @@ -259,7 +264,7 @@ if (has("gui_running") && g:solarized_degrade == 0)
let s:cyan = "#2aa198"
"let s:green = "#859900" "original
let s:green = "#719e07" "experimental
elseif (has("gui_running") && g:solarized_degrade == 1)
elseif (s:IsTruecolor() && g:solarized_degrade == 1)
" These colors are identical to the 256 color mode. They may be viewed
" while in gui mode via "let g:solarized_degrade=1", though this is not
" recommened and is for testing only.
Expand Down Expand Up @@ -490,7 +495,7 @@ exe "let s:fmt_revb = ' ".s:vmode."=NONE".s:r.s:b. " term=NONE".s:r.s:b."'"
exe "let s:fmt_revbb = ' ".s:vmode."=NONE".s:r.s:bb. " term=NONE".s:r.s:bb."'"
exe "let s:fmt_revbbu = ' ".s:vmode."=NONE".s:r.s:bb.s:u." term=NONE".s:r.s:bb.s:u."'"

if has("gui_running")
if s:IsTruecolor()
exe "let s:sp_none = ' guisp=".s:none ."'"
exe "let s:sp_back = ' guisp=".s:back ."'"
exe "let s:sp_base03 = ' guisp=".s:base03 ."'"
Expand Down Expand Up @@ -620,7 +625,7 @@ exe "hi! MoreMsg" .s:fmt_none .s:fg_blue .s:bg_none
exe "hi! ModeMsg" .s:fmt_none .s:fg_blue .s:bg_none
exe "hi! LineNr" .s:fmt_none .s:fg_base01 .s:bg_base02
exe "hi! Question" .s:fmt_bold .s:fg_cyan .s:bg_none
if ( has("gui_running") || &t_Co > 8 )
if ( s:IsTruecolor() || &t_Co > 8 )
exe "hi! VertSplit" .s:fmt_none .s:fg_base00 .s:bg_base00
else
exe "hi! VertSplit" .s:fmt_revbb .s:fg_base00 .s:bg_base02
Expand All @@ -642,7 +647,7 @@ exe "hi! DiffChange" .s:fmt_undr .s:fg_yellow .s:bg_none .s:sp_yellow
exe "hi! DiffDelete" .s:fmt_bold .s:fg_red .s:bg_none
exe "hi! DiffText" .s:fmt_undr .s:fg_blue .s:bg_none .s:sp_blue
else " normal
if has("gui_running")
if s:IsTruecolor()
exe "hi! DiffAdd" .s:fmt_bold .s:fg_green .s:bg_base02 .s:sp_green
exe "hi! DiffChange" .s:fmt_bold .s:fg_yellow .s:bg_base02 .s:sp_yellow
exe "hi! DiffDelete" .s:fmt_bold .s:fg_red .s:bg_base02
Expand Down Expand Up @@ -1090,6 +1095,26 @@ endfunction
autocmd ColorScheme * if g:colors_name != "solarized" | silent! aunmenu Solarized | else | call SolarizedMenu() | endif

"}}}
" Neovim Terminal {{{
if has('nvim')
let g:terminal_color_0 = s:base02
let g:terminal_color_1 = s:red
let g:terminal_color_2 = s:green
let g:terminal_color_3 = s:yellow
let g:terminal_color_4 = s:blue
let g:terminal_color_5 = s:magenta
let g:terminal_color_6 = s:cyan
let g:terminal_color_7 = s:base2
let g:terminal_color_8 = s:base03
let g:terminal_color_9 = s:orange
let g:terminal_color_10 = s:base01
let g:terminal_color_11 = s:base00
let g:terminal_color_12 = s:base0
let g:terminal_color_13 = s:violet
let g:terminal_color_14 = s:base1
let g:terminal_color_15 = s:base3
endif
" }}}
" License "{{{
" ---------------------------------------------------------------------
"
Expand Down