Why is the sky blue?
The blue color of the sky is due to Rayleigh scattering. As light moves through the atmosphere, most of the longer wavelengths pass straight through. Little of the red, orange and yellow light is affected by the air.
However, much of the shorter wavelength light is absorbed by the gas molecules. The absorbed blue light is then radiated in different directions. It gets scattered all around the sky. Whichever direction you look, some of this scattered blue light reaches you. Since you see the blue light from everywhere overhead, the sky looks blue.
As you look closer to the horizon, the sky appears much paler in color. To reach you, the scattered blue light must pass through more air. Some of it gets scattered away again in other directions. Less blue light reaches your eyes. The color of the sky near the horizon appears paler or white.
On Earth, the sun appears yellow. If you were out in space, or on the moon, the sun would look white. In space, there is no atmosphere to scatter the sun's light. On Earth, some of the shorter wavelength light (the blues and violets) are removed from the direct rays of the sun by scattering. The remaining colors together appear yellow.
Also, out in space, the sky looks dark and black, instead of blue. This is because there is no atmosphere. There is no scattered light to reach your eyes.