Planets do not give off their own light as they only reflect the light from a star such as the Sun.
Because the planets only reflect the light from the stars like the sun, this is why we can see the stars in the night sky which is them shining by reflected sunlight.
Planets lack the necessary conditions for nuclear fusion to occur which is the process which generates light in stars.
When sunlight hits a planet, then some of the sunlight is reflected back into space and allows us to see it.
And when we see the planet earth from space , we are seeing the reflected sunlight from the Sun.
The color that the sky appears in the absence of an atmosphere is black.
The sky appears black in the absence of an atmosphere because there is no air available to scatter sunlight so you would only see the darkness of space.
The blue color that we see in the sky on Earth is a result of a phenomenon known as Rayleigh scattering in which shorter wavelengths of light such as blue are scattered more by the molecules in the atmosphere which reach your eyes from all directions.
And without an atmosphere, there is no scattering so the sky would appear black instead of blue.
Basically the sky on earth appears blue because there is light scattering in the Earth's atmosphere.
And space appears black because there is no atmosphere to scatter the light.
Sunlight is scattered by air molecules and dust particles in the atmosphere and blue light is scattered more than the other colors because it travels in shorter waves.
There is nothing in space to scatter or re radiate any light to our eyes and at night space looks black because there is no nearby bright source of light to scatter.
Also as you go higher into the atmosphere, the sky also slowly turns black because there are fewer and fewer molecules to scatter light.
And even though space appears black it's not actually completely black as the universe actually does have a faint glimmer from distant stars and also galaxies.