What allows an octopus to change the color and texture of its skin in a specific pattern to better hide from predators while also displaying courtship attraction to potential mates?

AI Photo

What allows an octopus to change the color and texture of its skin in a specific pattern to better hide from predators while also displaying courtship attraction to potential mates?