Red cabbage could soon turn your food blue (and green and purple) – naturally.

Science magazine celebrates a new natural way to replace the artificial dyes that make candy, soda and ice cream blue – by stabilizing the pigments found inside red cabbage:

The food industry mostly relies on two synthetic dyes to create blue candies, cereals, and drinks: “brilliant blue,” also known as E131, and indigotine, or E132. Although these work well, “There has just been a really large push by consumers to get rid of synthetic ingredients in their food,” says Pamela Denish, a biophysicist at the University of California, Davis.

Replacing current dyes with natural colorants has proved difficult, however. That’s in part because there are few natural blues in nature. Pigments called anthocyanins, including those in red cabbage, can produce a blue color. But they’re not very stable, and they have a lot of purple undertones, Denish says. The latter becomes a problem when blending it with yellow to create green. “Purple plus yellow equals brown, so you’re not going to get a very vibrant green,” she says. That’s also a problem of spirulina blue, a crude extract derived from spirulina algae that has been approved in the United States as a natural dye for some foods.

In the new study, Denish and colleagues tried to get anthocyanins to hold onto their true blue color. The pigments in red cabbage are a mix of different molecules, and the researchers concentrated on a particularly promising one, which they call P2. Mixing this molecule with aluminum ions led to complexes with three of the P2 molecules arranged around one aluminum ion like spokes on a wheel. The complex was a stronger, more stable blue.

That only solved part of the problem, however. Only about 5% of the anthocyanins in red cabbage are P2, making the process terribly inefficient. Searching through databases of enzymes, the scientists hit on one—from bacteria—that could help convert some of the other anthocyanins into P2. And mutating the enzyme increased its efficiency. Now, about half of the anthocyanins in red cabbage could be turned into the blue P2 molecule, the team reports this week in Science Advances. “All of that is cleaned out of the final product,” Denish says. “So there’s not actually any bacteria or any enzymes in the pigment itself.”

You can read the Science Advances report here.