A black body is an idealized object that can absorb all wavelengths of electromagnetic radiation. It is therefore called black, but note that it is a confusing name since it can also buy its nature, emit all wavelengths of radiation and it is this emitted light which is its interesting feature. The emission spectrum of a black body depends solely on its temperature. The relationship between the temperature of a black body and the spectrum of the light it radiates is given by the Planck radiation equation. At room temperature, approximately 300 Kelvin, the radiation is mostly infrared, so not visible to the human eye. But as you start to increase the temperature, the black body's spectrum shifts to shorter wavelengths and the object starts to radiate in the visible part of the spectrum. As the object gets hotter, the relative amount of ultraviolet it radiates becomes larger. The perceived color, going from low to high temperatures, shifts from red to yellow to white to blue. Even though objects are almost never a perfect black body, they can sometimes be approximated as one and stars are perfect examples. This is the spectrum of the sun and the observed black body spectrum has a temperature of about 5800 Kelvin. The observation that it is not a perfect black body is due to the specific chemical composition of the star's surface, which allows you to further analyze this star. Different types of stars have different surface temperatures, and so emit different types of spectra. By measuring the spectrum and approximating the object as a black body, you are able to find the surface temperature. Stars can then be classified by their temperature, like relatively cold and small red and yellow dwarf stars, or hotter and larger white and blue stars.