This is a great question! It’s partly to do with being close to a light source (like the sun) but also with having an atmosphere to scatter that light. The night sky is black because we’re facing away from that light, and space is black even if you’re facing the sun because there is no atmosphere to scatter the light all around.
black or darkness isn’t actually a colour, it just means there is no light. So when we look into space and see blackness, that means there is no light coming from that part of the sky, like from a star.
Comments