The heating of the compound causing the electrons to become "excited" raising the energy level of the electrons. The extra energy causes the electrons to move to a higher quantum energy level.
The quantum energy levels have specific amounts of energy.
When the electrons " drop down" and lose the extra energy from the heat it is quantum levels. The specific amount of energy results in a specific wavelength of light corresponding to that energy level.
Each wavelength of light has its own specific color based on the amount of energy in that wavelength
So the movement of electrons between energy levels results in different colors of light.