In 1856, the precocious scientist William Henry Perkin failed in an experiment to synthetically produce quinine, a chemical that helps treat malaria. Instead of quinine, his beakers were left filled with a dirty brown sludge. But something amazing happened when Perkin, who was only 18 at the time, cleaned out those beakers with alcohol. The brown sludge became a bright, rich fuchsia-purple dye. This accident was the first discovery of a synthetic dye, which Perkin named “mauveine.” For this achievement, Google is celebrating Perkin with a Google Doodle on what would have been his 180th birthday.

Before Perkin’s discovery, dyes and pigments had to be sourced from plants, metals, minerals, or organic materials like bat guano, often at significant cost and effort. The element cadmium, for instance, can be ground down to make bright reds, oranges, and yellows. Lapis lazuli, a semiprecious stone, creates deep ultramarine blues. And you can make indigo, a natural purple-blue dye, from a subtropical plant, but it’s a lengthy and difficult process. These natural purple dyes also faded rapidly, the Yale chemistry department explains on its website.

Mauveine was a more permanent stain. And the discovery changed everything, beginning a long chain of chemistry advances that would make bright, inexpensive synthetic color available to the masses.

Here’s what mauveine looks like in fabric:

Though Perkin was young, he sensed a business opportunity, patented the dye, and quickly opened a dyeworks shop in London. And by 1862, Queen Victoria herself was wearing garments dyed with mauveine.

Perkin invented other synthetic colors as well, like Perkin’s Green (a turquoise-like hue) and another shade of purple, Britannia Violet. He also co-discovered a way to synthesize the pigment alizarin, commonly known to painters as alizarin crimson, a blood-red staple of any paint set.

Perkin died in 1907, but he is remembered each year by a prestigious chemistry prize that bears his name. The Perkin Medal is awarded to a chemist whose work has made a significant impact in a commercial or household application. Winners include Carl Djerassi, who helped create the first oral contraceptives. The most recent winner is Ann E. Weber, a former Merck scientist noted for her work in pharmaceuticals.

Today, most dyes you find in clothes are synthetic, and they come in every single color imaginable. And all these colors that stain our T-shirts, pants, dresses, and socks can be traced back to one accident in 1856.

Read more: Racked has a fantastic, in-depth story about modern-day indigo production.