If you ever manage to get yourself to the bottom of the Red Sea in the middle of night, you might think you were transported into James Cameron's "Avatar."

Here, corals glow in a rainbow of fluorescent colors, something a team of researchers recently discovered while diving more than 160 feet deep in the sea.

At these depths, the flashy critters like to show off their fluorescent pigments, which are actually proteins. When illuminated with blue or violet light, the pigments reflect colors with longer wavelengths — turning them into bright reds, oranges and greens.

In shallower parts of the sea, corals have been known to do this for a while, but only when assisted with blue or violet flashlights. Joerg Wiedenmann, one of the researchers on the team from the University of Southampton, said there had been hints of more fluorescence farther down, but it was only recently that anyone had diving equipment advanced enough to check it out first hand.

The fact that reefs in deeper levels not only have the same fluorescent properties as those above, but at even higher concentrations, is surprising. Scientists have theorized that these pigments are used like a natural sunscreen for organisms in the shallow areas, but very little sunlight ever gets down to the deep parts of the Red Sea.

So the question remains: Why? What's the evolutionary advantage to having these pigments? Or do these corals just enjoy the occasional glow-in-the-dark rave?

Scientists will continue to grapple with this mystery. In the meantime, Wiedenmann's team suggested this week in the research journal PLOS ONE that the pigments could have practical applications in medicine. The fluorescent glow can be used to highlight living cells or cell structures under a microscope, so they could be useful in tracking cancer cells or screening for new drugs.

"This discovery shows how little we know about coral reefs — and that we can get useful materials out of them," Wiedenmann said. "So it's important we take care of them."

Read More: