Metal salts that are commonly used in firework displays include: strontium carbonate (red fireworks), calcium chloride (orange fireworks), sodium nitrate (yellow fireworks), barium chloride (green fireworks) and copper chloride (blue fireworks). Purple fireworks are typically produced by use of a mixture of strontium (red) and copper (blue) compounds.
The metal salts are packed into a firework as pea to plum sized pellets called stars. After a firework is ignited, a lift charge propels the firework into the sky while a fuse slowly burns into the interior of the firework shell. As the fuse reaches the core of the firework, it explodes igniting the stars that contain the metal salts.
Excerpt from earthsky.org “How do fireworks get their colors?” by Deanna Conners