The flash is fast. A provoked blue-ringed octopus can turn the rings to a bright blue in about a third of a second, while the rest of the body shifts toward yellow. It reads as a light being switched on, and that is close to the mechanism. The blue is not a pigment being pumped into the skin. It is a mirror being uncovered.
In Hapalochlaena lunulata, each ring contains a stack of iridophores, multilayer reflectors that bounce blue-green light across a wide angle. Under ordinary conditions, muscles above those reflectors are contracted, and the mirror is hidden. When those muscles relax and muscles around the ring contract, the iridescence is exposed. Dark chromatophores, the pigment sacs, sit around and beneath the ring and can expand in about a second, deepening the black edge so the blue reads harder. There are no chromatophores laid over the ring itself. That is unusual. Most cephalopods use pigment to cover or tint their shine. Here the shine is the point, and the pigment is the frame.
The muscles are under direct nervous control, which is why the change is quick enough to function as a warning in the time it takes a hand, or a fish, to arrive. The display is aposematic. It is the same general idea as the colors of a poison dart frog or the bands of a coral snake: a conspicuous signal whose value depends on being believed.
The paper that laid this out carefully is Mäthger and colleagues in the Journal of Experimental Biology, 2012. The useful summary, standing over a pool, is simpler. If the rings light up, you are already closer than the animal wants you to be. The display is the request to leave.