Examples
The same technique on the shapes of content people actually have, and the same secret across palettes that mask well and badly. Every number here is measured on the page as you load it.
A wall of text
The element draws one line, because it rasterises with a single
fillText and does not wrap. A block of prose is therefore several
elements, one per line, which is worth knowing before you reach for it: nocap
suits a value you want to protect, not a document.
It also gets slower the more of it you have. Each element runs its own animation loop, and the readout below is honest about what this many costs.
Single values, which is what it is for
The same secret, five palettes
Masking ratio is
min(swing(text), swing(background)) / |text − background|. Swing
is how far a colour can travel in code values before clipping, so a colour near
0 or 255 has almost none and cannot carry noise however hard you push. Below
1.0 the value starts showing through a single captured frame.
Which palette is the default
Two answers ship in this repo, which is one too many, so here they both are measured rather than described.
| Where | Text on background | Ratio | Headroom |
|---|
The element's own default is the roomier pair, because a default should sit at the safe end for someone who sets no colours at all. The demo pages deliberately run darker, close to the darkest pair that still masks, so the page and the secret could sit at the same level and the trade would be visible rather than hidden behind a comfortable choice. Both are defensible. Quoting a leak number without saying which one it came from is not, which is why this table exists.