When heat is applied to the atoms that make up the material, some electrons have high energy levels and then fall to the lower levels. Some electrons emit as much energy as the energy level difference. By measuring the emitted light, we can detect if the material is made up of atoms.
The metal atoms mainly emit visible light at this time. Mixing this metal-containing ionic material with a gunpowder creates a fantastic fireworks display.