miu
miu

Reputation: 1304

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

Upvotes: 4

Views: 5810

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172510

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.

Upvotes: 6

Related Questions