How are the different colors of fire made in fireworks?
A flames color is dependent on the type of color generating compound that is used in that particular formula. Different chemical compounds release different wavelengths of light when their electrons change energy states. Here is a listing of the main color producing elements and their corresponding color:
Strontium compounds make RED Fire
Barium compounds make GREEN Fire
Copper compounds make BLUE Fire
Sodium compounds make YELLOW Fire
When the color producing compounds grab the energy (usually in the form of heat) from a combustion reaction, they become "excited" and will eventually lose that energy and go back to their original "ground" state. When they fall back to their ground state, they will release the energy in the form of a particle of light. The frequency (~color) is dependent on the amount of energy that it lost going back to it's ground state.
The addition of Aluminum, Titanium, or Magnesium, will have an effect of brightening the colored flame (since it raises the temperature of the reaction), but also lessens the purity of color. Different combinations of these color producing elements will theoretically give you almost any color you can imagine.
This is by no means instructions on how to make fireworks. It's much much much more complicated than described above, hence the reason there are no formulations shown here. There are many factors that go into actual formula making and should not be attempted unless you have the background, knowledge, licensing, and experience to safely handle pyrotechnic materials.