The color of the sky appears to be light blue from Earth's surface and black from space due to a phenomenon known as Rayleigh scattering.
When sunlight reaches Earth's atmosphere, it encounters tiny particles, such as nitrogen and oxygen molecules, as well as other airborne particles like dust and water droplets. These particles are much smaller than the wavelength of visible light, so they scatter light in different directions.
Shorter wavelengths of light, such as blue and violet, are scattered more than longer wavelengths, such as red and orange. This scattering phenomenon is known as Rayleigh scattering. As a result, the blue light is scattered in all directions by the particles in the atmosphere, and a portion of it reaches our eyes from all directions, creating a diffuse blue sky.
When we observe the sky from space, there is no atmosphere to scatter the sunlight. As a result, we see the true color of space, which appears black because there is no significant source of visible light in the immediate vicinity. However, stars and galaxies are visible in space, and they appear as points of light against the black background.
It's worth noting that the appearance of the sky can vary depending on factors such as atmospheric conditions, the angle of the Sun, and the presence of pollutants or other particles in the air. This is why the sky may appear different shades of blue or other colors at different times and in different locations on Earth.