" The scattering of blue component of the white sunlight by air molecules present in the atmosphere causes the blue color of the sky".
This can be explained as follows.
The sunlight is made up of seven coloured lights mixed together. When sunlight passed through the atmosphere, most of the longer wavelength light (such as red, orange, yellow, etc.) present in do not get scattered much by the air molecules and hence pass straight through. The shorter wavelength blue light is, however, scattered all around the sky by air molecules in the atmosphere.
Whichever direction we look, some of this scattered blue light enters our eyes. Since we see the blue light from everywhere overhead, the sky looks blue.
Thus, the sky appears blue because the molecules in the air (nitrogen and oxygen molecules) scattered blue part of the sunlight much more than they scatter red light (or other shades).
Please note that only a little of the blue light present in white sunlight is scattered by the atmosphere which makes the sky appear blue. Most of the blue light remains behind unscattered due to which the composition of sunlight remains almost unaltered. Because of this the direct sunlight coming through the blue sky still appears to be white.
If the earth had no atmosphere consisting of air, there would have been no scattering of sunlight at all. In that case no light from the sky would have entered our eyes and the sky would have looked dark and black to us.
In outer space, the looks dark and black instead of blue This is because there is no atmosphere containing air in the outer space to scatter sunlight. Since there is no scattered light to reach our eyes in outer space, therefore the sky looks dark and black there. This is why the astronauts who go to outer space find the sky to be dark and black instead of blue.
We know that the 'danger' signal lights are red in colour. This is because the red coloured light having longer wavelength is the least scattered by fog or smoke particles. Due to this red light can be seen in the same colour even from a distance.