* Sunlight is a mixture of all colors of the rainbow. This is why we see the sun as white or yellowish-white. It emits light across the entire spectrum.
* We see the sun as yellowish-white from Earth's surface. The atmosphere scatters blue light more effectively than other colors. This is why the sky appears blue. The sun's light gets filtered by the atmosphere, making it appear more yellowish.
* In space, the sun appears white. Without the atmosphere, the sun's true colors are all visible together, giving it a white appearance.
So, while we might think of the sun as yellow, it's actually a mixture of all colors, and the color we perceive depends on our perspective!