The sun as seen in outer space is quite white. It emits different
wavelengths with intensities given by the law of blackbody radiation. It
may feel a little strange to think of the sun as a black body. It just
means that the sun absorbs all the light striking it and is an equally good
radiator of electromagnetic radiation. (Good absorbers must also be good
radiators or they would get hotter than their surroundings).
The maximum intensity of light emitted by black body radiation is at a
wavelength given by the Wien Displacement Law which says: Wavelength of
maximum intensity in meters times temperature in Kelvin = 0.0029.
Since the temperature of the surface of the sun is around 5800 K, the sun
emits light of wavelength
500 nm with the greatest intensity. Since visible light extends from around
400 nm (purple) to 700 nm (red), all of which are emitted by the sun with
almost equal intensity, the sun looks white to our eyes.
In passing through our atmosphere, the shortest wavelengths (blue /purple)
are scattered most strongly. This answers one of the best known questions
in all of physics: "Daddy, why is the sky blue?" It also explains why
sunsets (and sunrises) tend to be reddish; much of the blue light is
scattered out after the sunlight has travelled through so much atmosphere
leaving a preponderance of red.