The Raffzahn's answer perfectly desribed why white on black CLI was result of technical limitations, and better technology together with GUI went for black on white.
I would like say more about, why even now is CLI white on black.
The main aspect of GUI is, that it is designed mainly (mainly) for content consumers. The screen should look "nice" and many times there are tone-in-tone colors used
Look at this site:
- the footer here is blue text on blue background, using 3 tones of blue and one grey, which does not stand out (yes and black titles too)
- The header is grey on black mainly.
- The main page use lot of gray items on white and lot of light blue items too.
Web pages, GUI tools and such today looks decent, professional and all (but some people with bad seeing have problems to read those so much decent shades), they also use the bonus of having 24-bits colors and would not fit to old 16, or 256 colors paletes as good.
All of it is mainly supposed to be processed by human eyes, so it prefere "niceness", knowing, that humans have extra strong "autocorrection ability" for reading, and that there is not problem, if some of similar characters (like .,;: or l1I|) looks nearly the same. Consumer will probably read the right version, even if actually wrong is used. The same goes for typos - many of them are just ignored or not recognized at first reading and it is not a problem - the right message will go thru anyway. Even if there are some elements to manipulate, they are typically big buttons or full words/phrases in different color (hyperlinks) and the consumer have just to choose from this selection offered and hit with mouse relatively big rectangle - somewhere.
And majority of text (if not all) is ment to be read fast, not preciselly deciphered to last character. Well, for exact copy there are Copy-Paste shortcuts, no need to make sure each character fits - just make sure, that the begin and end is right.
On the other hand CLI is maily used by programmers to be read by computer.
And computers do not have good autocorrection (and it would not be typically used in CLI commands/programs anyway, as the each character counts and using other, just visually similar, would probably make an error in the best case, unwanted (but legal) difference in worse case.
rm -rf test *
shows how one more space give totally different and harmfull (but syntactically correct) effect. )
So CLI prefere exact results and correctness over nice look. And usually is even set to bigger font and syntax highliting and just few bright, distintive colors on black (or dark) background. All for making harder to any mistake slips. The small number of bright colors on black backgroud makes everything highlited to really stand out and be totally distinctive from any other kind of highlites.
Those texts are supposed to be correct to last character and to be deciphered and weighted with extra care.
At least me and every other programmer, who I know have its programming evironment set it similar high-contrast scheme, while "normal web pages" are in "nice, decent tone" at the same time.
The dark background makes the bright collors (white, magenta, red, cyan ...) stand out more, then white backgroud, or even "old sepia picture with hint of light blue here and light pink there" background, which is to be seen an many webpages.
The relative small number of colors (and only few cases of inverted background on the most critical spots) make it easier to distinguish exact meaning of such marked phrases, words or even single characters.
So the result for "darker gray on lighter gray" GUI and "bright on black" CLI is not only result of nostalgia, but also (and mainly) result of different use (reading vs. programming) and different targets (readers vs. computer programs)
BTW, if I remember correctly, than Spectrum BASIC was black on white (and bad readable too) as well as some other examples and lot of old BIOS screens. TurboPascal used Yellow on Blue for text and Black on White for menus in days, where Hercules cards was common here and lot of PCs had CGA graphic cards, just few had VGA one. So other approaches also existed in old good times :)