As we just saw, the blue part of a gas flame comes from electrons falling from excited high energy levels to their normal lower levels. We can use the same mechanism to get colors other than blue. We just need to add some atoms or molecules that have different energy levels.
The easiest color to add to a flame is the bright yellow we get by adding sodium. Ordinary table salt will work just fine. We can soak a paper towel in salt, and let it dry, and then burn it. Or we can just sprinkle some salt into a gas flame.
Copper is famous for its blue and green colored compounds. If we put some copper compounds into a flame, we get pretty blues and greens.
Lithium salts make red flames, and strontium salts make even brighter red flames. Barium salts make blue-green flames, and potassium makes violet flames.
When we want to make fireworks with sparks of different colors, we can add these compounds to the burning materials.
Some burning materials make colors by other mechanisms. Magnesium burns with a bright white light, because it is hot enough to get into the white region of the blackbody radiation curve. Similarly, orange colors in fireworks are often made from glowing balls of carbon, hot enough to glow orange.