diff --git a/README.md b/README.md index aa3dd21..fc85b63 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ slightly earthy tone. - [g:srcery\_bg\_passthrough](#gsrcery_bg_passthrough) - [g:srcery\_guisp\_fallback](#gsrcery_guisp_fallback) - [g:srcery\_italic\_types](#gsrcery_italic_types) + - [g:srcery\_bg](#gsrcery_bg) - [g:srcery\_hard\_black\_terminal\_bg](#gsrcery_hard_black_terminal_bg) - [Screenshots](#screenshots) - [Plugin support](#plugin-support) @@ -297,6 +298,13 @@ Italicize types if italic is enabled. Default: 0 +#### g:srcery\_bg + +Background color, specified as an RGB value. +Note that this will only work with 'set termguicolors' in your config, and that it is mutually exclusive with 'g:srcery_hard_black_terminal_bg'. + +Default: 'g:srcery_black' + #### g:srcery\_hard\_black\_terminal\_bg If enabled, will set the terminal background in vim to hard black. diff --git a/after/syntax/html.vim b/after/syntax/html.vim index 521b123..99af331 100644 --- a/after/syntax/html.vim +++ b/after/syntax/html.vim @@ -26,22 +26,12 @@ call srcery#helper#Highlight('htmlLink', s:bright_white, s:none, s:underline) hi! link htmlSpecialChar SrceryYellow -if g:srcery_bg_passthrough == 1 && !has('gui_running') - call srcery#helper#Highlight('htmlBold', s:bright_white, s:none, s:bold) - call srcery#helper#Highlight('htmlBoldUnderline', s:bright_white, s:none, s:bold . s:underline) - call srcery#helper#Highlight('htmlBoldItalic', s:bright_white, s:none, s:bold . s:italic) - call srcery#helper#Highlight('htmlBoldUnderlineItalic', s:bright_white, s:none, s:bold . s:underline . s:italic) - call srcery#helper#Highlight('htmlUnderline', s:bright_white, s:none, s:underline) - call srcery#helper#Highlight('htmlUnderlineItalic', s:bright_white, s:none, s:underline . s:italic) - call srcery#helper#Highlight('htmlItalic', s:bright_white, s:none, s:italic) -else - call srcery#helper#Highlight('htmlBold', s:bright_white, s:black, s:bold) - call srcery#helper#Highlight('htmlBoldUnderline', s:bright_white, s:black, s:bold . s:underline) - call srcery#helper#Highlight('htmlBoldItalic', s:bright_white, s:black, s:bold . s:italic) - call srcery#helper#Highlight('htmlBoldUnderlineItalic', s:bright_white, s:black, s:bold . s:underline . s:italic) - call srcery#helper#Highlight('htmlUnderline', s:bright_white, s:black, s:underline) - call srcery#helper#Highlight('htmlUnderlineItalic', s:bright_white, s:black, s:underline . s:italic) - call srcery#helper#Highlight('htmlItalic', s:bright_white, s:black, s:italic) -endif +call srcery#helper#Highlight('htmlBold', s:bright_white, g:srcery_bg, s:bold) +call srcery#helper#Highlight('htmlBoldUnderline', s:bright_white, g:srcery_bg, s:bold . s:underline) +call srcery#helper#Highlight('htmlBoldItalic', s:bright_white, g:srcery_bg, s:bold . s:italic) +call srcery#helper#Highlight('htmlBoldUnderlineItalic', s:bright_white, g:srcery_bg, s:bold . s:underline . s:italic) +call srcery#helper#Highlight('htmlUnderline', s:bright_white, g:srcery_bg, s:underline) +call srcery#helper#Highlight('htmlUnderlineItalic', s:bright_white, g:srcery_bg, s:underline . s:italic) +call srcery#helper#Highlight('htmlItalic', s:bright_white, g:srcery_bg, s:italic) " }}} diff --git a/autoload/srcery.vim b/autoload/srcery.vim index 5a67525..8d83588 100644 --- a/autoload/srcery.vim +++ b/autoload/srcery.vim @@ -116,10 +116,6 @@ if !exists('g:srcery_italic') endif endif -if !exists('g:srcery_bg_passthrough') - let g:srcery_bg_passthrough=0 -endif - if !exists('g:srcery_undercurl') let g:srcery_undercurl=1 endif @@ -152,6 +148,18 @@ if !exists('g:srcery_italic_types') let g:srcery_italic_types=0 endif +if !exists('g:srcery_bg') + "Sets the default color for both guisp and cterm backgrounds. + let g:srcery_bg=[g:srcery_black, 0] +elseif (index(g:srcery_bg, 'DEFAULT') >= 0) || (index(g:srcery_bg, 'NONE') >= 0 && has('gui_running')) + "Defaults should be set if the user specifies it, or if the background is set as 'NONE' whilst the gui is running. + for i in [0, 1] + if g:srcery_bg[i] ==# 'DEFAULT' || (g:srcery_bg[i] ==# 'NONE' && has('gui_running')) + let g:srcery_bg[i] = (i==1 ? 0 : g:srcery_black) + endif + endfor +endif + if !exists('g:srcery_hard_black_terminal_bg') let g:srcery_hard_black_terminal_bg=1 endif diff --git a/colors/srcery.vim b/colors/srcery.vim index 810f220..4f70b79 100644 --- a/colors/srcery.vim +++ b/colors/srcery.vim @@ -171,11 +171,7 @@ call s:HL('SrceryXgray6', s:xgray6) " Normal text " -if g:srcery_bg_passthrough == 1 && !has('gui_running') - call s:HL('Normal', s:bright_white, s:none) - else - call s:HL('Normal', s:bright_white, s:black) -endif +call s:HL('Normal', s:bright_white, g:srcery_bg) if v:version >= 700 " Screen line that the cursor is @@ -206,11 +202,7 @@ if v:version >= 703 call s:HL('Conceal', s:blue, s:none) " Line number of CursorLine - if g:srcery_bg_passthrough == 1 && !has('gui_running') - call s:HL('CursorLineNr', s:yellow, s:none) - else - call s:HL('CursorLineNr', s:yellow, s:black) - endif + call s:HL('CursorLineNr', s:yellow, g:srcery_bg) endif @@ -237,19 +229,11 @@ call s:HL('Underlined', s:blue, s:none, s:underline) call s:HL('StatusLine', s:bright_white, s:xgray2) -if g:srcery_bg_passthrough == 1 && !has('gui_running') - call s:HL('StatusLineNC', s:bright_black, s:none, s:underline) - - " The column separating vertically split windows - call s:HL('VertSplit', s:bright_white, s:none) - - " Current match in wildmenu completion - call s:HL('WildMenu', s:blue, s:none, s:bold) -else - call s:HL('StatusLineNC', s:bright_black, s:black, s:underline) - call s:HL('VertSplit', s:bright_white, s:black) - call s:HL('WildMenu', s:blue, s:black, s:bold) -endif +call s:HL('StatusLineNC', s:bright_black, g:srcery_bg, s:underline) +" The column separating vertically split windows +call s:HL('VertSplit', s:bright_white, g:srcery_bg) +" Current match in wildmenu completion +call s:HL('WildMenu', s:blue, g:srcery_bg, s:bold) " Directory names, special names in listing hi! link Directory SrceryGreenBold @@ -274,19 +258,13 @@ hi! link WarningMsg SrceryRedBold " Line number for :number and :# commands call s:HL('LineNr', s:bright_black) -if g:srcery_bg_passthrough == 1 && !has('gui_running') - " Column where signs are displayed - " TODO Possibly need to fix SignColumn - call s:HL('SignColumn', s:none, s:none) - " Line used for closed folds - call s:HL('Folded', s:bright_black, s:none, s:italic) - " Column where folds are displayed - call s:HL('FoldColumn', s:bright_black, s:none) -else - call s:HL('SignColumn', s:none, s:black) - call s:HL('Folded', s:bright_black, s:black, s:italic) - call s:HL('FoldColumn', s:bright_black, s:black) -endif +" Column where signs are displayed +" TODO Possibly need to fix SignColumn +call s:HL('SignColumn', s:none, g:srcery_bg) +" Line used for closed folds +call s:HL('Folded', s:bright_black, g:srcery_bg, s:italic) +" Column where folds are displayed +call s:HL('FoldColumn', s:bright_black, g:srcery_bg) " }}} " Cursor: {{{ @@ -307,11 +285,7 @@ hi! link Special SrceryOrange call s:HL('Comment', s:bright_black, s:none, s:italic) -if g:srcery_bg_passthrough == 1 && !has('gui_running') - call s:HL('Todo', s:bright_white, s:none, s:bold . s:italic) -else - call s:HL('Todo', s:bright_white, s:black, s:bold . s:italic) -endif +call s:HL('Todo', s:bright_white, g:srcery_bg, s:bold . s:italic) call s:HL('Error', s:bright_white, s:red, s:bold) @@ -388,31 +362,19 @@ if v:version >= 700 " Popup menu: selected item call s:HL('PmenuSel', s:bright_white, s:blue, s:bold) - if g:srcery_bg_passthrough == 1 && !has('gui_running') - " Popup menu: scrollbar - call s:HL('PmenuSbar', s:none, s:none) - " Popup menu: scrollbar thumb - call s:HL('PmenuThumb', s:none, s:none) - else - call s:HL('PmenuSbar', s:none, s:black) - call s:HL('PmenuThumb', s:none, s:orange) - endif + " Popup menu: scrollbar + call s:HL('PmenuSbar', s:none, g:srcery_bg) + " Popup menu: scrollbar thumb + call s:HL('PmenuThumb', s:none, s:orange) endif " }}} " Diffs: {{{ -if g:srcery_bg_passthrough == 1 && !has('gui_running') - call s:HL('DiffDelete', s:red, s:none) - call s:HL('DiffAdd', s:green, s:none) - call s:HL('DiffChange', s:cyan, s:none) - call s:HL('DiffText', s:yellow, s:none) -else - call s:HL('DiffDelete', s:red, s:black) - call s:HL('DiffAdd', s:green, s:black) - call s:HL('DiffChange', s:cyan, s:black) - call s:HL('DiffText', s:yellow, s:black) -endif +call s:HL('DiffDelete', s:red, g:srcery_bg) +call s:HL('DiffAdd', s:green, g:srcery_bg) +call s:HL('DiffChange', s:cyan, g:srcery_bg) +call s:HL('DiffText', s:yellow, g:srcery_bg) " }}} " Spelling: {{{ @@ -436,7 +398,6 @@ if g:srcery_hard_black_terminal_bg == 1 && has('terminal') " Therefore not useful with transparent background option call s:HL('Terminal', s:bright_white, s:hard_black) endif - " }}} " Neovim LSP: {{{ diff --git a/doc/srcery.txt b/doc/srcery.txt index 661267d..53480b8 100644 --- a/doc/srcery.txt +++ b/doc/srcery.txt @@ -28,6 +28,7 @@ Options |srcery-options| g:srcery_bg_passthrough |srcery-option-bg-passthrough| g:srcery_guisp_fallback |srcery-option-guisp-fallback| g:srcery_italic_types |srcery-option-italic-types| + g:srcery_bg |srcery-option-bg| g:srcery_hard_black_terminal_bg |srcery-option-hard-black-terminal-bg| ============================================================================== @@ -242,6 +243,13 @@ g:srcery_italic_types Default: 0 + *srcery-bg* +g:srcery_bg + Background color, specified as an RGB value. + Note that this will only work with `set termguicolors` in your config, and that it is mutually exclusive with `g:srcery_hard_black_terminal_bg`. + + Default: `g:srcery_black` + *srcery-option-hard-black-terminal-bg* g:srcery_hard_black_terminal_bg