(NEXSTAR) — With July 4, and summer in general, upon us, it’s likely that you’re taking in a fireworks show or two. But have you ever wondered what makes the fireworks glow red, blue and nearly every color in between?

If you were paying attention during high school science class, you may already know. 

The fireworks we see in the sky are created by the explosion of multiple small pellets of black powder, known as stars, once the powder has been ignited. Those stars can be arranged so that the fireworks create different shapes in the sky. 

What is used to make those stars also impacts the color of the fireworks. 

They all have the main ingredient — black powder — and are then combined with a certain chemical or mineral. That chemical or mineral will then make the firework a different color after it reacts with the heat from the explosions. 

There are seven mineral elements commonly used in fireworks, according to the U.S. Geological Survey

To create red fireworks, strontium is used. The mineral is also used in ceramic magnets and oil and gas production. Sodium, the fourth-most abundant mineral in the world, is used for yellow fireworks. Blue fireworks are created with copper. 

Like mixing paint to create different colors, the above minerals are combined to make different-colored fireworks. Mixing strontium and sodium will make orange fireworks, while strontium and copper lead to purple explosions. 

Copper and sodium aren’t used to make green, though. Instead, the green glow is caused by barium (technically barium chloride). 

For gray and white fireworks, three minerals are used: titanium, zirconium and magnesium. 

Aluminum powder will cause bright flashes and the loud bangs often associated with fireworks, while iron filings and charcoal pieces can lead to gold sparks. 

Regardless of what color your fireworks will be this year, make sure to be safe around them. Nearly 73% of the nation’s fireworks-related injuries in 2022 happened in the weeks before and after July 4, according to the U.S. Consumer Product Safety Commission

To avoid injury, the CPSC recommends that you don’t try to re-light or pick up fireworks that didn’t ignite, and don’t use fireworks while impaired. Have water or a hose handy in case of a fire, and light the fireworks one at a time. Also, be sure to keep fireworks away from children.