Why not use pure black (#000) and pure white (#FFF)?
The first thing youâ€™ll notice is that itâ€™s really black
*Jin points out that technically itâ€™s not quite black: itâ€™s #212121.
In its CSS I see,
background: #2f2f2f; background: rgba(0, 0, 0, 0.8);
Why not "really black": why is "not quite black" better?
Similarly, for the rest of the background I see something like,
Why not pure white?
I'm not asking about StackExchange specifically -- what I mean is, is this a good general rule for any/all web sites: when the design spec seems to ask for black or white, should I use almost black and white instead of really black and white?
Does this 'rule' apply to any other colors too (what is the rule, exactly)?
Is the rule device-dependent?
In short, it's easy on the eyes;
'Simply put, contrast is the difference between two colors. On a web page, the amount of contrast required varies with different parts of the page. You usually want a high contrast between text and its background color. But too high contrast between design elements might give an unsettled and messy impression. Black and white create the highest contrast possible.' -Quote from here
This is a great site for UX colour suggestions/examples and theory. And discusses the contrast of different colours on background, even giving the hex code which is quite handy.
Contrast and colour balance is discussed here also.
This also seems to be a style that's trending because the lower contrast between bckgrounds makes the contrast of the text a little nicer(in my opinion) as seen with the colour here and here These samples are more for looking at the colour than their content in terms of what I want to communicate here.
It's not necessarily a rule more of a preference or style. It's more content-dependent than device-dependent. It's about where you want to have the most emphasis or focus - wherever that happens to be is where there should be the most contrast. In the case of StackExchange it's all about questions and answers so the body is where there is most contrast as that is where it is most relevant.
Good luck with your colour choices in future, this is another consideration to take into account :D