All objects emit electromagnetic radiation according to their temperature. Colder objects emit waves with very low frequency (such as radio or microwaves), while hot objects emit visible light or even ultraviolet and higher frequencies.
Blackbody radiation is a term used to describe the relationship between an object's temperature, and the wavelength of electromagnetic radiation it emits. A black body is an idealized object that absorbs all electromagnetic radiation it comes in contact with. It then emits thermal radiation in a continuous spectrum according to its temperature.
Simplified animation showing the different blackbody curves for red stars, yellow stars, and blue stars. Credit: Alice Hopkinson, LCO
Stars behave approximately like blackbodies, and this concept explains why there are different colors of stars. Red stars are cooler, and they emit the most radiation in the red wavelengths. A hotter star like our sun emits the most radiation in the yellow/green part of the spectrum.
We don't see any stars as green because stars with peak wavelengths in the green also emit lots of radiation in the red and blue part of the spectrum. Our eyes combine all of these colors and we see white in this case. Even hotter stars and other objects emit the most radiation in the blue, ultraviolet or even x-ray and gamma ray part of the spectrum. Objects like these appear blue to our eyes. Much cooler objects like planets and humans emit the most radiation in the infrared. Even cooler objects emit microwaves and radio waves.
The animation above shows blackbody curves for a red star, a yellow Sun-like star and a blue star. A star like our Sun produces the most energy in the yellow/green part of the visible spectrum. It also produces ultraviolet and infrared, though in smaller amounts than the visible region. A hotter blue star emits more elecromagnetic radiation in the Ultraviolet part of the spectrum. A cooler object like a brown dwarf emits most of its radiation in the infrared.
This interactive animation shows a more detailed look at the relationship between the temperature, peak wavelength and intensity of light from a black body.
The video below explains more about how a star's color is related to its temperature, and why we don't see green stars:Â
Why aren't there any green stars? Credit: NASA