Squid have special cells on their skin that allow them to change patterns of color for camouflage and communication.

The females in one species of squid may have a natural defense for escaping unwanted male attention: special light-reflecting cells that can create the illusion of testes.

Like many of its cousins, the opalescent inshore squid (Doryteuthis opalescens) of the Eastern Pacific Ocean is equipped with shimmery cells on its body that can change color for camouflage and communication.

But while studying the species, researchers at the University of California, Santa Barbara (UCSB) noticed that some opalescent inshore squid had bright iridescent rainbow stripes underneath their fins. [See Stunning Photos of Deep-Sea Squid]

"Sometimes most of the squid in a batch would have them, sometimes none," Daniel DeMartini, a UCSB doctoral student, said in a statement. "After a while we started to realize the rainbow stripes were only seen in the females."

In investigating the phenomenon, DeMartini found all females were capable of producing these colorful stripes. A peek at the underlying tissue under a microscope showed that it was full of iridocytes — the cells that give these squid their iridescent, rainbow markings. What's more, these patches of iridocytes were packed with layers of a light-changing protein known as reflectin, making them six times brighter than other blotches of the color-changing cells, the researchers said.

As these rainbow streaks emerged on the squid, so did a bright white patch on the squid's body that was made up of leucophore cells, which also contain reflectin proteins but only give off white light.

The researchers say this is the first time "switchable" leucophores have been found in squid. Experiments showed that the white-colored cells turn on in response to the neurotransmitter acetylcholine, just as iridocytes do.

"This discovery reveals a fundamental relationship between the switchable leucophores and the tunable color-producing iridocytes, suggesting they share a mechanism at the molecular level," DeMartini said.

DeMartini noted that the white stripe looks very similar to the white testes seen in male squid. Turning on these leucophores could help females look like males to avoid attention from notoriously aggressive males, the researchers say.

Scientists are interested in studying the color-changing properties of squid cells as a possible model for bio-inspired adaptive optics. They also hope to learn more about how cephalopods communicate.

Recently, researchers strapped an underwater camera on the elusive jumbo squid to watch it flashing its colors in its natural habitat. The squid seemed to make alternating red-and-white color signals when they encountered another individual of their species, the researchers observed, though it was not clear what the signs might mean.

Follow Megan Gannon on Twitter and Google+. Follow us @livescience, Facebook & Google+. Original article on LiveScience.