Planc in 1900 put forward a theory called Planck's quantum theory. in that he wrote that radiant energy is emitted or absorbed not continously but discontinuously in the form of small discrete packets of energy. the energy of each quantum is directly proportional to the frequency of the radiation. thats - E
v or E = hv where h is planck's constant, E's energy an v is freq.
when some solid substance is heated, the atoms of the substance are set into oscillation an emit radiation freq,v. now, as heatin's contd., more an more energy's absorbed by atoms an they emit radiations of higher an higher freq. as red light has min freq an yellow has higher, therefore, the body on heatin becomes red, then yellow an so on.