The phenomenon behind the sky being blue is called Rayleigh Scattering. We can study the color of the sky in depth. It is because of how the sunlight reaches the Earth.
Sun’s white light is made up of all colors of the rainbow- VIBGYOR. Light travels in waves and different types of light are created by different types of waves. The different colors of light are determined by how stretched out all the light waves are: like the long, more stretched red color or short, less stretched blue color. These scattering of light waves could be easily seen with a help of a prism
All these colors together make the spectrum of visible light- which we see with our bare eyes.
Now the question is Why only blue light is visible among all other colors, in the sky?
The blue color of the sun’s light comes from the ray hitting the Earth’s atmosphere. When the sun’s rays reach the atmosphere they are scattered in all directions due to gases present in the atmosphere. These gases are mostly able to scatter the shorter waves of light (the shortest being the blue light). So, what we see is the scattered form of the Blue light in the sky.
“Then why does the sky appear different at sunset?”
During sunset at one part of the Earth, the sun’s light rays are able to hit the atmosphere, even more, causing blue light to scatter even before reaching our eyes. The next colors which get scattered are orange & yellow. Therefore, the sunset sky appears orange to our eyes.
In some cases, the sky becomes glowing red. It is because of the scattered particles of dust, pollution & smoke.
Hence, to conclude, the blue sky is the safest color!