You're probably overlooking the additional attributes set in the cterm=
field for those highlights.
For instance, after I set ctermfg=black ctermbg=white
for StatusLine
, I get this when I query it:
:hi StatusLine
StatusLine xxx term=bold,reverse cterm=bold,reverse
ctermfg=0 ctermbg=15 gui=bold,reverse
You'll see the cterm=bold,reverse
there, which is part of the defaults for StatusLine
. In particular, reverse
will swap fg & bg colors, which is the effect you're seeing.
Since those attributes are set in a separate field (cterm=
), which you're not overriding, the defaults are being preserved.
To undo the effects of this field, you could set it explicitly, with:
hi StatusLine cterm=bold
Or, to also drop the bold
attribute:
hi StatusLine cterm=reverse
Or you could just decide to embrace the default of using reverse colors on the StatusLine
and perhaps some other highlight groups and just set your fg & bg colors in reverse, to then have the reversing applied by cterm=
get the colors as you actually want them. 🙃
Also consider the term=
(for B&W terminals) and gui=
(for gvim) attributes, if you're considering setting custom highlighting that you'd like to work on those environments as well.