A recent documentary from PBS includes a fascinating clip of an octopus changing colors while sleeping. The marine biologist involved in Octopus: Making Contact thinks that the sea creature was dreaming about hunting, which sparked the color shift to a camouflaged shade. Dr. David Scheeldescribes his theory in the documentary:
So here she’s asleep, she sees a crab and her color starts to change a little bit. Then she turns all dark. Octopuses will do that when they leave the bottom. This is a camouflage, like she’s just subdued a crab and now she’s going to sit there and eat it and she doesn’t want anyone to notice her. …This really is fascinating. But yeah, if she’s dreaming that’s the dream. […]
Source: A Dreaming Octopus’s Imagination is Revealed in Her Color-Changing Slumber