What makes fireworks colorful?

It all thanks to the luminescence of metals. When certain metals are heated (over a flame or in a hot explosion) their electrons jump up to a higher energy state. When those electrons fall back down, they emit specific frequencies of light - and each chemical has a unique emission spectrum.

You can see that the most prominent bands in the spectra above match the firework colors. The colors often burn brighter with the addition of an electron donor like Chlorine (Cl). 

But the metals alone wouldn’t look like much. They need to be excited. Black powder (mostly nitrates like KNO3) provides oxygen for the rapid reduction of charcoal (C) to create a lot hot expanding gas - the BOOM. That, in turn, provides the energy for luminescence - the AWWWW.

Aluminium has a special role — it emits a bright white light … and makes sparks!

Images: Charles D. Winters, Andrew Lambert Photography / Science Source, iStockphoto, Epic Fireworks, Softyx, Mark Schellhase, Walkerma, Firetwister, Rob Lavinsky, iRocks.com, Søren Wedel Nielsen