@@ -82,22 +82,21 @@ function! indent_guides#highlight_colors()
82
82
if has (' gui_running' )
83
83
call indent_guides#gui_highlight_colors ()
84
84
else
85
- call indent_guides#cterm_highlight_colors ()
85
+ call indent_guides#basic_highlight_colors ()
86
86
endif
87
87
endif
88
88
endfunction
89
89
90
90
"
91
- " Defines the indent highlight colors for terminal vim.
91
+ " Defines some basic indent highlight colors that work for Terminal Vim and
92
+ " gVim when colors can't be automatically calculated.
92
93
"
93
- " NOTE: This function contains no magic at the moment, it will simply use some
94
- " light or dark preset colors depending on the `set background=` value.
95
- "
96
- function ! indent_guides#cterm_highlight_colors ()
97
- let l: colors = (&g: background == ' dark' ) ? [' darkgrey' , ' black' ] : [' lightgrey' , ' white' ]
94
+ function ! indent_guides#basic_highlight_colors ()
95
+ let l: cterm_colors = (&g: background == ' dark' ) ? [' darkgrey' , ' black' ] : [' lightgrey' , ' white' ]
96
+ let l: gui_colors = (&g: background == ' dark' ) ? [' grey15' , ' grey30' ] : [' grey70' , ' grey85' ]
98
97
99
- exe ' hi IndentGuidesEven ctermbg=' . l: colors [0 ]
100
- exe ' hi IndentGuidesOdd ctermbg=' . l: colors [1 ]
98
+ exe ' hi IndentGuidesEven guibg= ' . l: gui_colors [ 0 ] . ' ctermbg=' . l: cterm_colors [0 ]
99
+ exe ' hi IndentGuidesOdd guibg= ' . l: gui_colors [ 1 ] . ' ctermbg=' . l: cterm_colors [1 ]
101
100
endfunction
102
101
103
102
"
@@ -116,6 +115,10 @@ function! indent_guides#gui_highlight_colors()
116
115
" color name is being used, eg. 'white'
117
116
let l: color_name = matchstr (s: hi_normal , s: color_name_bg_pat )
118
117
let l: hi_normal_guibg = color_helper#color_name_to_hex (l: color_name )
118
+
119
+ else
120
+ " background color could not be extracted, default to basic colors
121
+ call indent_guides#basic_highlight_colors ()
119
122
endif
120
123
121
124
if l: hi_normal_guibg = ~ s: color_hex_pat
0 commit comments