also called mix-blend-mode · invert on crossing · self-inverting overlay
One property, no JavaScript, and the overlay never has to know what is behind it. What it cannot survive is mid-grey, where inverting a value returns very nearly the value you started from. Plan for that band rather than discovering it on the one slide that has it. White set to difference becomes, pixel by pixel, the opposite of what lies beneath: black over white, white over black, a new tone over every picture. Over middle grey the opposite of the tone is nearly the tone itself, so the line all but disappears — the one place to keep it away from.
How it is built
.line { position: sticky; top: 50%; color: #fff;
mix-blend-mode: difference } /* each pixel: |white − what is behind| */
.zone { background: lab(calc(var(--z) * 10%) 0 0) } /* Zone V = L* 50 */
.walk { isolation: isolate } /* what the line may blend with */In full, on GitHub index.html showcase.css
Photographs — Ansel Adams, Photographs of National Parks and Monuments, compiled 1941–42, Records of the National Park Service, National Archives, public domain, via Wikimedia Commons: 79-AA-G01, 79-AA-T26, 79-AA-T06, 79-AA-W06. Facts — Zone System; NASA, the Golden Record’s images.