In "Fireworks, the Art, Science, and Technique", Takeo Shimizu gives a very good explanation of color production. For blue, the color-producing firework chemical is thought to be copper monochloride. If there is no free chlorine in the flame, there can be no blue color.The discovery of colors produced by chlorine along with other elements belongs to Chertier, who described the phenomena in 1836.In years past, mercurous chloride, also known as calomel, was used. Calomel decomposes at ordinary flame temperatures into chlorine and mercury metal vapor. Along with potassium chlorate ,mercurous chloride(calomel) was used as the oxidizer in older blue firework star compositions, calomel was often included to insure that plenty of chlorine was available.
Today we know that mercury is a very bad actor in the environment, witnessed by the birth defects in Japan resulting from mercury poisoning, not to mention the deaths!
Making Pharaoh's Snakes

Tomasz Szymborski, Creative Commons License
Ignite a small pile of mercury(II) thiocyanate, $\ce{Hg(SCN)2}$.Mercury thiocyanate is an insoluble white solid which can be purchased as a reagent or can be obtained as a precipitate by reacting mercury(II) chloride or mercury(II) nitrate with potassium thiocyanate (All mercury compounds are toxic and probably banned for this reason).
- Igniting mercury(II) thiocyanate causes it to decompose into an insoluble brown mass that is primarily carbon nitride, $\ce{C3N4}$. Mercury(II) sulfide and carbon disulfide are also produced.
$$\ce{2Hg(SCN)2 → 2HgS + CS2 + C3N4}$$
- Flammable carbon disulfide combusts to carbon(IV) oxide and sulfur(IV) oxide:
$$\ce{CS2 + 3O2 → CO2 + 2SO2}$$
- The heated $\ce{C3N4}$ partially breaks down to form nitrogen gas and cyanogen:
$$\ce{C3N4 → 3(CN)2 + N2}$$
- Mercury(II) sulfide reacts with oxygen to form mercury vapor and sulfur dioxide. If the reaction is performed inside a container, you will be able to observe a gray mercury film coating its interior surface.
$$\ce{HgS + O2 → Hg + SO2}$$