Octopuses are known for their astonishing ability to rapidly shift their skin color and texture, to hide from predators, to sneak up on prey and to communicate with each other.

But what exactly is going on when octopuses change color in their sleep?

Footage that recently circulated on Twitter offered a rare glimpse of a Caribbean two-spot octopus (Octopus hummelincki) sleeping out in the open in its well-lit aquarium. And as it snoozed, the cephalopod's skin color changed dramatically, from light to dark and back to light again. [8 Crazy Facts About Octopuses]

The video was captured in October 2017 at Butterfly Pavilion, a nonprofit invertebrate zoo in Westminster, Colorado. Rebecca Otey, then a science and conservation intern for the zoo, shot the footage and shared it on YouTube on Feb. 16, 2018.

At the start of the clip, the napping octopus was a pearly-white color. But as it slumbered, dark patterns that pulsed with the animal's breath appeared on its skin. Then, a flood of dark color washed over its body, slowly fading back to white.

Color changes like these are caused by the octopus's chromatophores, which are specialized pigment cells that expand or contract to alter colors and patterns on its body. Two other types of cells, iridophores and leucophores, are thought to detect the colors that the octopus's skin then matches. Without them, octopuses likely couldn't recognize those hues — because octopuses are colorblind, Sara Stevens, an aquarist with Butterfly Pavilion, told Live Science.

"The exact processes of how they match colors is still not fully understood, though it's being very thoroughly studied," Stevens said. "But current research suggests that the actual cells themselves can match colors."

(Image credit: Video by Rebecca Otey, courtesy of Butterfly Pavilion)

Cephalopods typically activate their camouflage superpowers in response to changing conditions around them. So, does this resting octopus's color display mean that it's dreaming about a threat? Research into cephalopod sleep and dreaming has grown over the years, but even so, there isn't yet enough evidence to say for sure if they dream the way that people do, according to Stevens.

"It's been hypothesized that octopus species can exhibit something very similar to REM cycles in humans — but the jury's still out on whether they're achieving REM sleep," Stevens said.

Unlike humans (or any vertebrates), octopuses don't have a centralized brain. Instead, they have multiple "brains" — bundles of neurons — distributed in their limbs. This unusual nervous system lends octopuses precise control over their color-changing cells; however, that ability may not be entirely under their control all the time, Stevens said.

"But there are no definitive answers to the questions: Are they dreaming? and What do they dream about?" she added.

Originally published on Live Science.