You have almost certainly seen it. A huge wave curls over three long, narrow boats, its edge breaking into claws of foam, and far behind it sits a tiny Mount Fuji. It is on mugs, phone cases, tote bags and posters all over the world.

Look at the blue. That deep, even blue in the water is a big part of why the picture feels so alive. It was not a Japanese colour. It was first made in Berlin in the early 1700s, by accident, by a colour maker who was trying to make a red.

The odd part is the timing. Hokusai made the print around 1831, when Japan had kept most of the outside world away for about two hundred years. So how did a paint from Berlin get in, and why did printmakers in Edo (the old name for Tokyo) grab it so fast?

A country with the door almost shut

In the 1630s the shogun’s government cut most of Japan’s ties with Europe. It feared the spread of Christianity, which had arrived with Portuguese traders and missionaries, and in 1639 Portuguese ships were banned. For the next two centuries, ordinary people could not travel abroad, and most foreigners could not come in.

One harbour left open

But the door was never shut all the way. One port, Nagasaki, still traded with the outside world. Chinese merchants sailed in. And one group of Europeans was allowed to stay: the Dutch.

The Dutch were kept on Dejima, a small fan-shaped island built in Nagasaki harbour, about 1.5 hectares, or roughly two football pitches. Their trading post moved there in 1641 and stayed for more than two hundred years. Even the name later given to the whole policy came out of this harbour: an interpreter in Nagasaki coined the word sakoku, “closed country”, in 1801, while translating a German doctor’s book about Japan.

The blue came this way too. A little of it had arrived by the 1760s, when a Japanese scholar described it in a book, but it stayed rare and costly. The flood came later, and through Chinese merchants: from around 1826, they began bringing it in large amounts and selling it cheaply. In Japan it got a nickname, bero-ai: bero from “Berlin”, ai meaning indigo.

Why printmakers wanted it

Printmakers already had two blues, and neither was easy. One, made from the petals of a small blue flower called the dayflower, faded quickly. The other, real indigo, was fiddly: printers had to draw the colour back out of old indigo-dyed cloth before they could print with it.

The new blue was easy to use and held its colour, and it could be printed in smooth shades from deep to pale. That is exactly what you want for sky and water. Around 1830 it began to show up in woodblock prints, and Hokusai was one of the first to take it up.

His series Thirty-six Views of Mount Fuji, which includes the Great Wave, showed off the new blue. For skies and water, he blended it with the old plant indigo.

So a paint invented in Berlin, carried in by Chinese merchants, became the colour of Japan’s best-known picture of its own sea and its own most famous mountain.

Then the door swung the other way

In 1853 American warships arrived and pushed Japan to open its ports. Japanese prints began to reach Europe, and the blue that had come in through Nagasaki now went the other way, printed on paper.

Many artists in Europe fell for these prints. In 1887 the painter Vincent van Gogh copied one in oils: a plum garden by Hiroshige, another Edo printmaker who also worked with the new blue. Hokusai’s wave travelled too. When a piece of music about the sea, La Mer by the French composer Claude Debussy, was printed in 1905, the wave was on its cover.

Next time you see that wave on a mug, look at the blue. It came into Japan through the one harbour left open, and a few decades later, printed into the wave, it went back out into the world.