For this, u must be familier to the phenomenon of refraction, which the bending to light when it passes from one medium to another and when there will be no atmosphere then for sure density of every 1mm will be different as well this varied density results in refraction and it will cause the white light of sun to get scattered in its 7 constituent colours. Why? because the wavelength of all of its seven colours is different and thus their bending will also be.
Just hoping, i helped you atleast at once only :(