We said a couple times while talking about flames that all matter gives off electromagnetic radiation (EMR or light) according to its temperature. Flames contain hot particles and so they glow. The law that describes how EMR is given off as a function of temperature is called Planck’s Law, and any matter that follows Planck’s Law perfectly is called a black body.
The Planck’s Law equation above gives you qλ, which is the energy flux at a given wavelength. (Remember EMR has a wavelength.) On the right side you plug in the temperature T and the wavelength λ. All the rest of the symbols are famous constants.
Max Planck devised his law in 1900, and this was the first observation that led to quantum mechanics.