Terminals (going back to a lineage tracing back to the original xterm) typically support 16 colors, from a pallettepalette mapping numbers 0 to 15 to the different colors. Typically color 0 is black and color 15 is bright white.
But usually with modern terminal emulators, you can actually configure this pallettepalette to something else (anything else.) Most pallettespalettes will keep the general arrangement of colors, just adjust the brightness or perhaps adjust the hue or saturation, but keep them around the same spots...
Other pallettespalettes are more radical and shift everything around, in order to have three or four shades of the light color and three or four shades of the dark color (at the cost of having fewer actual colors available in the pallettepalette.) For a very well known example of such a color pallettepalette, see the "solarized" theme.
So it's quite possible (or even probable) that the pallettepalette your Termite is configured to has color 0 mapped not to pitch black (#000000
), but to the same dark gray (#3f3f3f
) that you have for your background. That would be typically a color pallettepalette with less contrast and it wouldn't be unusual to find you're using one.
Now there's also the concept of foreground and background colors (or perhaps "default" foreground and background), which nowadays often are separate from the colors in the pallettepalette. So, counting those two, you can end up with a total of 18 distinct basic colors available for the application (though it's also quite common to pick the default foreground and background from the pallettepalette too.)
From the point of view of an application running inside the terminal, it can set attributes to pick among the 16 colors in the pallettepalette for foreground and background of the next characters to be output to the screen, or you can "clear attributes" which will drop your color selections and go back to your "default" foreground and background colors.
My bet here is that the default background color is this dark gray (#3f3f3f
) that you mentioned, and it also coincides with color 0 in the default pallettepalette, so that's why you can't distinguish them apart.
When you're updating your Termite config to set bacckground = white
, you're changing this default background color. However, you'll notice that the background color is totally detached from the pallettepalette... So color 0 from the pallettepalette will continue the same, which is most probably the dark gray (#3f3f3f
), so now you can see it.
Note that the pallettepalette is not necessarily reversed when you switch to a light background, which means color 0 in the pallettepalette is no longer same or very close to the background, but now it's the one with most contrast to it. (Color 7 is perhaps now the one closer to the background color, that's usually a very light gray. Or color 15 which is usually a brighter white.)
One other factor you might find interesting is that Vim allows you to compensate for a distinction between the pallettepalette and the "default" background. This is implemented in form of the 'background'
option, which you can query with :set background?
and you can change with :set background=light
or :set background=dark
.
In your specific case, with ctermbg=0
, nothing will change by setting that option. But Vim colorschemes may react to it, by deciding to use different colors depending on what 'background'
is set to. Many well made themes will essentially include two full sets of color choices, one for dark and one for light. It's quite possible that your Vim theme is doing that, and actually using color 0 (and not the default background color) when 'background'
is set to dark
, in which case even if your default background color is distinct from color 0 from the pallettepalette, the Vim colorscheme might be using 0 for background, making it the same as your color column.
And you should also know that Vim tries to "guess" which setting of 'background'
to use, based on the "default" background color your terminal is using. Most modern terminals allow programs to query them for the color settings (including querying the pallettepalette colors and even setting the pallettepalette colors.) Vim tries to query the terminal for the background color at startup. It then calculates the brightness of the color and sets 'background'
appropriately, depending on whether the brightness number indicates that it's a light or a dark color.
That's why even if your Vim colorscheme will hardcode color 0 for normal background when 'background'
is set to "dark", it is also able to use a different color when your Termite background is now set to white. Vim will detect it and set 'background'
to "light" and the colorscheme will know not to use color 0 for the background anymore, but either keep the default, or pick a light color from the pallettepalette.
This discussion bypasses most of the higher color support in terminals. Nowadays you get terminals with 256-color support (the base 16 from the pallettepalette are typically configurable, the remainder are typically standard, though some terminals might allow you to set them from the application too) and "True Color" support, which means terminal applications are able to use 24-bit colors to get the full gamut from #000000
to #ffffff
. The most common situation (lowest common denominator) is 16-color support, with the customizable pallettepalette, with default foreground and background, so I limited the discussion to that setting, which I believe should fully explain what you're experiencing.