The darkness of space is not caused by shadows cast by planets and stars. Instead, it is primarily due to the absence of light. Space is a vacuum, devoid of air or particles that can scatter or reflect light. Additionally, light from distant stars and galaxies gets attenuated as it travels through space, leading to a decrease in brightness.
In the absence of a nearby light source, such as a star or a planet reflecting sunlight, space appears dark to the human eye. Even within our own solar system, the space between planets is mostly dark, with only the direct light from the Sun illuminating the surrounding objects.
While planets and stars can cast shadows in their immediate vicinity, these shadows are relatively localized and do not contribute significantly to the overall darkness of space. The vast distances and the absence of a pervasive light source are the primary factors responsible for the darkness experienced in outer space.