Neither the heavens nor the universe radiate light. The only light source of significance to us is the sun. The sun radiates white light. Hence, a spaceman sees a white sun. But the white light is composed of all the colors of the rainbow. We can observe this by shining white light through a prism or of course through a rainbow itself.
When the white light from the sun enters the Earth's atmosphere, it immediately reacts with the gas molecules. The light is scattered by the air molecules. It can be compared to the scattering of light in fog. It seems as if the light does not only come from the light source, but also from the water droplets in the mist.
Exactly how much the light is scattered depends on the wavelength, and therefore on the color of the light. The scattering is described with the formula by the British Nobel laureate Lord Rayleigh.
The important thing about this formula is that the amount of Rayleigh scattering is inversely proportional to the wavelength (λ) to the 4th power. The wavelength of blue light is about twice as short as that of red light. And therefore the scattering of blue light is about 24=16 times greater than that of red light.
Blue light is therefore best scattered, green and yellow light less well and red light passes almost straight through the atmosphere. The result is that the sky turns blue. Due to the scattering, the white light has lost a bit of its color. The result is that the sun turns yellow.
In the universe there is no air. The light is therefore not scattered and the sky is black with a white sun.
At dawn and dusk, light has to travel a remarkably longer distance through the atmosphere before reaching us. As a result, the blue light is almost completely scattered and a part of the yellow light is now also scattered. What remains are more orange and red tones.
Just after a major volcanic eruption, when the soot and dust particles are still floating around in the atmosphere, the light is scattered even more. Especially then, the reddest and, in the opinion of many people, the most beautiful sunsets are observed.