Not much is known about how flatworms protect themselves. Though flatworms have poor eyesight, they are able to sense dark and light and perhaps direction and use these senses to seek out dark places under rocks to hide. In addition, many have coloration that helps them blend into their surroundings, and some are active only at night. Some marine flatworms use color, toxins and camouflage as defense against predators.
Flatworms present good targets as prey because of their soft, delicate bodies. Flatworms' best defense may be camouflage, which helps them either to hide in plain sight or to masquerade as other animals entirely. Some flatworms may match their texture and color to the food they prefer to eat.
Some marine flatworms seem to have the most obvious defense in that their coloring is an adaptation that makes them invisible. Like many invertebrates, marine flatworms have evolved the use of color mimicry. Perhaps this is so their coloration mimics fish, most of whom have good eyesight. Other marine flatworms defy the principle of camouflage by displaying bright colors and pattern. This adaptation also may serve as a protection, because it warns predators that their intended prey may be toxic. Many marine flatworms secrete toxins that can make a predator let go before the flatworm is killed.