The two squares below are pixel-for-pixel the identical gray, #8a8a8a. Yet the one on a dark background reads lighter, and the one on a light background reads darker — the brain computes "how bright relative to this surround," not an absolute value.
This is exactly why contrast can't be judged by eye alone. The moment a background color changes, the perceived contrast of any text or icon sitting on it changes too — so real design work always checks contrast against the actual final background, not a color value read off a picker.
The more saturated the background, the stronger the illusion, so it's worth extra caution any time a neutral element — an icon, a border — sits on a vivid background.
When to use
Re-check perceived contrast any time a background changes — the illusion persists even when the numeric ratio stays identical.