If you've watched the sunset and noticed that one night the sky is pink and the next night it is orange, you may find yourself asking friends or strangers why the colors are what they are. When you're snapping pictures of a California sunset and emailing them around the world or posting to Facebook, it isn't actually as important to know why...but some of us want to know. And for those who do, here goes!
Light waves travel. When the sun goes down, those waves originating from the distant sun travel farther through the atmosphere before reaching your vision. They scatter more, bouncing and reflecting off of more things on their way. Water vapor, ice, soot, ash, and the gases that make up the atmosphere all come into play in determining the colors you see. You especially notice this when wildfires fill the air with soot and the sky looks red even during the day. Atmospheric contents and conditions help to create specific colors.
As less light reaches you directly, the sun appears less bright. The color of the sun itself appears to change, first to orange and then to red. Short wavelengths that create colors such as blue and green scatter with less reaching your vision.
Out in space or on the moon, the sun looks white and the sky looks black. In space, there is no atmosphere to scatter the sun's light. On Earth, some of the shorter wavelength light (the blues and violets) are removed from the direct rays of the sun by scattering. The remaining colors together appear yellow. Photos taken with most cameras make the sun look white due to the light meter readings that attempt to adjust and average out the various light sources, taking into account "hot spots" such as the sun.
Because there is no atmosphere in space and no scattered light to reach your eyes, the sky looks dark and black, instead of blue.