That’s a great question! Have you ever done flame tests in science? The colours in fireworks mostly come through the exact same process! So copper compounds will give you blues, sodium salts will give you bright oranges, magnesium will give you bright silver or white etc… Have a look at these
There are actually lots of other flame colours () but some of the cool ones are a bit dangerous or expensive to use in fireworks – radium is radioactive and caesium and rubidium are way too reactive. Shame – they look really pretty!