Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get the background color in vim?

Is it possible to get the background color of the current color scheme in vim?

I tried :hi Normal but the response isn't helpful: Normal xxx cleared

like image 732
miu Avatar asked Oct 20 '25 04:10

miu


1 Answers

If there's a way, it's through :hi Normal (or rather :echo synIDattr(hlID("Normal"), "bg"), which avoids the need to capture the command output); I don't know about any other means, e.g. a dedicated getbgcolor() function. For me, this works fine (in Windows GVIM):

Normal         xxx guibg=#FFFBF0 font=Courier:h10:cANSI

If the guibg attribute doesn't appear, I guess that means that the (operating system's) default background color is used; i.e. nothing has been set.

like image 124
Ingo Karkat Avatar answered Oct 22 '25 06:10

Ingo Karkat