Light Creation
The sun is made up primarily of hydrogen. Through gravitational attraction, the temperatures and pressures inside the sun allow hydrogen atoms to fuse into helium. This nuclear fusion takes place deep within the sun, creating large amounts of energy that heats the sun's core to very high temperatures. The energy passes through the main bulk of the sun and then radiates away at a thin outer layer called the photosphere. This takes place at a temperature of about 6,000 kelvin.
Energy Output
The sun emits energy all across the electromagnetic spectrum. The visible portion of the spectrum spans from about 4,000 angstroms to 7,500 angstroms. The photosphere temperature drives the distribution of the sun's energy output. The sun's peak output is about 5,000 angstroms, which is near the middle of the visible spectrum. A hotter star will emit most of its energy in the bluer part of the spectrum, while cooler stars tend to peak in the red or infrared regions.
Color Combinations
Sunlight includes all the colors in the visible spectrum. When all these colors are combined, your eye perceives the combination as white. But passing a beam of sunlight through a glass prism shows that the original beam includes all the different colors. Each color represents a different wavelength of light.
Atmospheric Effects
The sun's color is also affected by the Earth's atmosphere. The molecules in the air scatter the incoming light from the sun. The wavelengths scattered depend on the size of the particles. Particles the size of air molecules scatter light primarily at the blue wavelengths. This causes the sky to be blue, and it takes some of the blue out of the sunlight. The loss of blue light makes the overall color appear to move toward the red side of the spectrum. This moves the apparent color of sunlight into the yellow region.
Other Colors
Earth's atmosphere causes some of the colorful effects seen at sunrise and sunset. These depend on the amount of atmosphere the light travels through. During the middle parts of the day, the sun is more perpendicular to the Earth's surface, so its light passes more directly through the atmosphere. At sunrise or sunset, the light has to pass through the atmosphere at a shallower angle, creating a much longer path through the air. The longer path allows for more scattering of the blue light, pushing the overall sun color more toward the red.