How fireworks work (see www.howstuffworks.com) provides a very interesting overview of fireworks. See all sections. See the review on the chemistry of fireworks [local].
While black powder was invented by the Chinese 1000 years ago, pyrodex often is used in its place today. Pyrodex is described as a mixture of KClO4, KNO3, sulfur, carbon, sodium benzoate, and dicyandiamide (1-cyanoguanidine).
Colors in fireworks are obtained by including appropriate salts. More on color [local] .