Here's why:
* The Sun is a giant ball of hot gas. This gas emits a continuous spectrum of electromagnetic radiation, including light.
* We perceive different wavelengths of light as different colors. When all the wavelengths of visible light are combined, our eyes see white.
* When light from the sun passes through the Earth's atmosphere, some wavelengths are scattered more than others. This scattering is what gives the sky its blue color, and makes the sun appear redder at sunrise and sunset.
So, while we can talk about the colors in sunlight, the sun itself doesn't actually "emit" colors in the way we might think. It emits light containing all the colors of the rainbow, which we see as white.