Cephalopods are the masters of camouflage, as I've written about before. But what happens if they have to try to match two different backgrounds? Allen and colleague (containing several members who worked on the paper I wrote about earlier) tackle this problem with cuttlefish (Sepia officinalis).
There's a couple of possibilities. Because octopus and squid and such can control colour on each half of their body independently, they'll try to match both sides. Another possibility is that they will opt to match only one pattern, and the third option is that they'll opt for something half-way between both.
This paper does some other experiments with substrate choices. When they tested more than one substrate at a time, the animals didn't have strong preferences. When given just two choices, cuttlefish like gray bottoms over white ones. But the key finding in substrate choices was that cuttlefish strongly prefer anything that lets them bury themselves.
Why bother trying to look inconspicuous out in the open if you can just hide?
Allen, J., Mathger, L., Barbosa, A., Buresch, K., Sogin, E., Schwartz, J., Chubb, C., & Hanlon, R. (2009). Cuttlefish dynamic camouflage: responses to substrate choice and integration of multiple visual cues Proceedings of the Royal Society B: Biological Sciences DOI: 10.1098/rspb.2009.1694