← Vibe Coding Lab

Colour-Changing Camouflage

Cuttlefish, octopuses and flounders change the colour and pattern of their skin to blend in with what they sit on. Chameleons and geckos change colour too, for other reasons and far more slowly. Put each animal on a seabed, on your camera's picture or on a photo of your own, drag it around, and watch its skin respond.

Skin close-up
Drop the picture here

Drag the animal to move it. It looks at the ground around it and changes its skin to match.

Animal

Background

Pictures and video stay on your device.

Camouflage

Size
Turn
Mood

What these animals actually do

No animal copies its background like a photograph. What they can do is look at their surroundings and set a few things on their skin: how light or dark it is overall, how much contrast it has, and how big the light and dark patches are. Those few settings are enough to make an animal very hard to see. The simulator does the same: the animal measures the ground in a ring around it, never the picture under itself, and then sets its skin. Switch to Perfect copy to see the thing none of them can do.

Cuttlefish and octopus: a screen of coloured dots run by the brain

The skin of a cuttlefish or an octopus is covered in chromatophores: tiny elastic bags of yellow, red or brown pigment, each ringed by radial muscles. When a nerve from the brain fires, the muscles pull the bag open into a wide coloured disc; when it stops, the bag shrinks back to a speck. Because each chromatophore is wired to the brain, a whole pattern can appear or vanish in a fraction of a second. Turn on the skin close-up to see them.

Under the chromatophores lie two layers of reflecting cells. Iridophores are stacks of thin plates that give shimmering blues and greens. Leucophores scatter all colours equally: they are white, so they take on the colour of whatever light falls on them. In blue water they look blue, on red rock they look reddish. That is part of how cuttlefish and octopuses match colours even though their eyes have only one kind of light receptor, which should make them colour-blind. Octopus skin also contains light-sensitive proteins, so the skin itself may sense light.

Cross-section of cuttlefish skin: chromatophores on top, iridophores, then leucophores chromatophores pigment bags pulled open by muscles, in a blink nerves from the brain iridophores stacked plates: blue, green leucophores white: reflect the colour of the light around open shut
Cephalopod skin in cross-section (not to scale). Opening and shutting the pigment bags over the white leucophores sets how dark and how coloured each spot of skin is.

Three patterns are enough

Cuttlefish do not invent a new pattern for every background. Researchers who put them on sand, gravel and checkerboards found that almost everything they show is one of three kinds of pattern, or a mix:

The simulator's cuttlefish follows this rule: it measures the contrast in the ground around it and the size of the light and dark patches, and mixes the three patterns from that. Try it:

Octopuses use mottles and plain colours too, and also change the shape of their skin. Small muscles raise bumps and spikes called papillae, so the skin looks as rough as the rock or algae beside it. The simulator's octopus raises them when the ground around it has fine detail.

Flounders: hiding on the sea floor

Flatfish lie on the bottom with both eyes on the upper side. In 1911 Francis Sumner put flounders on checkerboards and got fish with squares on their backs. Later work on tropical flounders showed they match the brightness, the contrast and the size of the spots on the ground around them, within seconds. Their colour cells are dark melanophores, yellow xanthophores and reflecting iridophores, and nerves control them, though not as directly or as finely as in a cuttlefish.

Chameleons: mostly not camouflage

The famous colour-changer is the least about camouflage. Chameleons are already green or brown at rest, which hides them well among leaves and branches. Their quick changes are mostly signals to other chameleons: a male meeting a rival flares into yellow and orange. Temperature matters too: a cold chameleon turns darker to soak up sunlight. A chameleon put on a checkerboard does not grow squares.

The colour does not come mainly from pigment. Its skin holds cells called iridophores filled with a regular lattice of tiny guanine crystals. Light reflecting from the lattice interferes, so the lattice reflects one colour strongly; that colour depends on how far apart the crystals are. A relaxed chameleon keeps the crystals close and reflects blue. Seen through the yellow pigment cells above, blue plus yellow gives green. An excited chameleon swells the lattice, and the reflection moves to yellow, orange and red. Move the Mood slider with the chameleon chosen to see this.

Chameleon iridophore lattice: crystals close together reflect blue, far apart reflect orange yellow pigment cells relaxed: crystals close reflects blue → seen as green yellow pigment cells excited: lattice swollen reflects orange → seen as orange
After Teyssier and colleagues (2015). The colour a lattice reflects depends on the spacing of the crystals, like the colours in a soap film depend on its thickness.

Geckos: slow, by hormones

Many lizards, geckos among them, lighten and darken by moving grains of dark melanin inside cells called melanophores: spread out, the skin goes dark; bunched in the middle of each cell, it goes pale. In most lizards hormones in the blood control this, not nerves, so it takes minutes to hours. The gecko in the simulator therefore runs as a time-lapse. Its pattern of lines and lichen-coloured blotches never changes; it only sets how light or dark it is.

The leaf-tailed geckos of Madagascar add a trick that has nothing to do with colour. A fringe of skin runs along the jaw, body and legs. Pressed against a branch, the fringe hides the shadow that would otherwise outline the animal. Untick Skin flaps to see the shadow come back.

Other animals that change colour

AnimalWhat changesHow fastWhy
Cuttlefish, octopus, squidChromatophores opened by muscles under direct nerve control; papillae change skin textureA fraction of a secondCamouflage, signals, startle displays
Flounders and other flatfishMelanophores and other pigment cells, under nerve controlSecondsMatching the sea floor
ChameleonsSpacing of guanine crystals in iridophores, plus melaninSeconds to minutesMostly signals and body temperature
Many lizards and frogs, some geckosMelanin spread or bunched in melanophores, under hormonesMinutes to hoursBrightness matching, temperature
Crab spidersYellow pigment made or removed in the bodyDaysMatching white or yellow flowers
Arctic fox, snowshoe hare, ptarmiganA whole new coat or plumage, moultedWeeks, with the seasonsWhite in winter snow, brown in summer
Mimic octopusColour, pattern and body postureSecondsImpersonating other animals, such as lionfish and sea snakes

Many more animals are camouflaged without changing at all, such as stick insects, stonefish and leaf-mimicking butterflies. Their colour and shape were set by evolution, and they hide by choosing where to rest.

What the simulator does

Simulated: every animal measures the ground in a ring around itself: the average colour, the contrast, and the size of the light and dark patches. It then sets its skin from those numbers, changing at its own speed. The cuttlefish chooses between uniform, mottle and disruptive patterns by the rule above; its chromatophores open and shut over white, light-reflecting cells, so the skin takes on the colour of the light around it. The chameleon's colour comes from a lattice reflection filtered through yellow pigment. The gecko only darkens or lightens.

Drawn, not measured: the shapes, the exact patterns, the sizes and numbers of the colour cells and the thresholds of the pattern rule are illustrations in the spirit of the research, not fitted to data. The chromatophores are fewer and larger than real ones so the close-up can show them. Speeds are the right order of magnitude; the gecko runs about thirty times faster than life.

Sources