Why consoles/terminals usually have a black background?

In unix and window systems, the console has a black background. Is this historical or is there any UX reasoning behind it?

I'm working on a web based terminal and giving the window the look and feel of a terminal. When it comes to background color, I was torn between black, white or any other color.

Additionally, MacOS uses a white background as the default terminal background. Is there any reason for choosing black or white background for terminals?