The atmosphere is predominantly made of two gases, hydrogen and oxygen. These molecules absorb and scatter different kinds of light. Red, yellow and orange light travels longer distances so they are not absorbed, but blue light is absorbed by the gas molecules and radiated, creating the blue sky you see every day. That blue light is not as visible from space, but plays a role in the blue color of the Earth. At night, the sunlight no longer is around to interact with the gases, so the sky become black.
The Earth has many oceans and seas, from the Arctic Ocean to the Southern Ocean. Although there is red-hot heat below the surface of the Earth, the top layer is dominated by water. The oceans cover about 71 percent of the Earth and are blue, while land makes up the other 29 percent and varies in color. This gives the Earth the appearance of a blue marble. If the earth consisted mainly of land masses, it would be appear to be a different color completely.
Although water covers a large percentage of the Earth, it is important to understand why the water is blue as well. As with our atmosphere, most of the colors of the light spectrum are absorbed by the water. The water radiates the blue in the spectrum, giving it its blue color. If another color was absorbed, say red for instance, the Earth would look red from outer space. The land masses of the Earth do not look blue due to this same principle.
The Earth only appears blue if you are looking at it from outer space on the side that is being lit by the sun. When you are orbiting the Earth, it will appear black when you orbit around a part of the Earth that is experiencing night. Since there is no sun to create the light, all of the Earth will appear somewhat dark. The stars will be more visible as well during this period. Land masses will appear somewhat dark blue, as there are light sources that illuminate the sky on land.