The compound barium chloride burns green at wavelength of 589 nanometers which is in the middle of the visible light spectrum. Color is produced by heating metal salts such as barium chloride, calcium salts or sodium salts.
The amount of energy that is released by the burning compound is shown in a particular wavelength which corresponds to a color. Higher energies burn blue/purple at shorter wavelengths while lower energies burn red which corresponds to longer wavelengths. The energy absorbed rearranges the electrons from a ground state to an excited state. At this state the light is emitted then the electrons slowly return back down to the lower ground state, as stated in Chemical of the Week.