There are three main types of light production in pyrotechnics:
This is when solid or liquid particles of matter are heated to a very high temperature (at least 1500oC, preferably about 2-3000) and give off the excess energy as light. The substance gives of light throughout the spectrum, at higher temperatures with a shorter wavelength, at lower temperatures with a longer wavelength. The intensity is proportional to T4 where T is the temperature of the substance.
An everyday example of this is an incandescent light bulb. The filament is heated to a very high temperature and it glows with a yellowish-white light.
When metals are oxidised, the resulting metal oxide is heated to a very high temperature, causing it to emit incandescent light. This is what is seen in flares, for instance, a typical flare might contain magnesium and an oxidiser, which would burn with a bright white light. If the particles of metal are made larger they continue to burn once expelled into the atmosphere. This is what produces sparks and showers.
This is when certain chemicals are vaporised in a pyrotechnical flame such that the atoms become excited, causing the electrons in their shells to jump from their ground state (up to the next shell) and the compound to become ionised. When they return to the ground state again they emit a photon at a certain wavelength. Each time this happens it is called the nth ionisation energy, therefor what has just been described would be the 1st ionisation energy.
This is the way by which spectacular and colourful fireworks of today produce colour.
Molecular emission is basically the same, however, if the substance is heated too high the molecule decomposes and no light is emitted.
This emmision of light occurs the same way as in a flourescent/gas discharge/cathode ray tube (they are all basically the same thing). As the electrons flow from the cathode to the anode, the atoms are caused to go into an excited state, emitting a photon when they go back to the ground state.
Sodium is one of the strongest atomic light emiters. It produces a yellow-orange light having a wavelength of 589nm. It is so strong that when included with other colour emiters it often washes them out completely. The US Military uses sodium nitrate as an oxidiser mixed with magnesium to provide light for night-time operations.
Colours are normally achieved from the ionised salt of a particular metal. Some of the more commonly used metal compounds and their ions for some of the more commonly radiated colours are listed below:
These are ions which are not stable at room temperature, are only stable at very high temperatures and as a result cannot be included as is into a pyrotechnic composition. For this reason they are synthesized in fast chemical reactions within the flame. The chemicals normally used are a nitrate of the metal and a chlorine donor. Chlorine donors also decrease incandescent light and hence make the coloured light more visible.
Chlorate and perchlorate oxidizers are really the only oxidisers which serve a dual purpose as a donor and oxidiser.
Blue is the most difficult colour to produce, because the copper compounds used are destroyed if the temperature is too high, but if the temprature is too low, not enough light is produced. This is the same for all colours, but blue has a narrow range of temperature which works. A good measure of the quality of a pyrotechnic demonstration is the quality of the blue which is produced.