In the earliest days of the United States, John Adams wrote to his wife Abigail about the celebration of independence, “It ought to be solemnized with Pomp and Parade, with Shews, Games, Sports, Guns, Bells, Bonfires and Illuminations from one End of this Continent to the other from this Time forward forever more.” “Bonfires and illuminations” refer directly to what we know as pyrotechnics and firework displays.

I’m a chemist and also president of Pyrotechnics Guild International, an organization that promotes the safe use of fireworks and using them here in the U.S. to celebrate Independence Day and other festivals throughout the year. As a chemist, and someone who leads demonstrations for chemistry students, I consider fireworks a great example of combustion reactions that produce colored fire. But the invention of colored fireworks is relatively recent and not all colors are easy to produce.

Early history of fireworks

Firecrackers were first invented serendipitously by the Chinese in 200 B.C. But it wasn’t until one thousand years later that Chinese alchemists developed fireworks in 800 A.D. These early fireworks were mostly bright and noisy concoctions designed to scare evil spirits – not the colorful, controlled explosions we see today. Fast forward another millennium and the Italians figured out how to add color by introducing various elements to the flammable mix. Adding the element strontium to a color pyrotechnic mix produces a red flame; copper, blue; barium, green; and sodium for yellow.

Too much or too little of the chemicals make significant changes in the temperature and thus the wavelength of color seen. The proper mixture of chemicals when ignited produce enough energy to excite electrons to give off different colors of light.

Even though the chemistry of these colors isn’t new, each generation seems to get excited by the colors splashed across the sky. We now have a wide range of flame colors: red, green, blue, yellow, purple, and variations of these.

Each color works the same way. As different elements ignite they release different wavelengths of light which translate as different colors.

Tom Handel , CC BY-SA

Making that perfect blue firework

Not all colors of fireworks are equally easy to create. I believe several of my colleagues in pyrotechnic research and development would agree with me that blue is the most difficult color to produce.

That is because the evening sky is a shade of blue, which means that most blues do not show up as well. If you try to make the blue brighter to contrast with the background it can look washed out. The right balance of copper and other chemicals in the flame or combustion reaction produce the best blue color flame in a firework.

I have taken this into account when trying to create the best blue flame color, which I call pill box blue. It is just bright enough to stand out against the night sky but still a rich blue. I have over 20 blue pyrotechnic formulas and I have found one that comes very close to this elusive hue.

Another difficulty in creating an intense blue color is that the chemistry is not simple. It requires a combination of several chemicals and the element copper. When copper ignites, the electrons surrounding the copper atoms get excited and energized in the flame. When the electrons release this energy, it appears to observers as blue light. Each color works the same way. As different elements ignite they release different wavelengths of light which translate as different colors. So when you see blue-colored dots of light creating a pattern in the night sky, you really are seeing excited electrons releasing energy as blue light.

[ Expertise in your inbox. Sign up for The Conversation’s newsletter and get a digest of academic takes on today’s news, every day. ]