Menu

After you invert an image, how do you tell whether anything is still readable?
πŸ“°

After you invert an image, how do you tell whether anything is still readable?

DEV Community: cssΒ·owen zhangΒ·about 18 hours ago
#AMSjTD20
#devtocss#devto#dev#contrast#dfn
Long article (868 words) β€” no AI summary yet.
Reading 0:00
15s threshold

Inverting an image is one click. Deciding whether the result is usable takes a different question, and it is not "does it look inverted". It is "did the contrast between the things that must be told apart survive the flip".

What inversion actually changes

Inversion works per channel: each red, green and blue value v becomes 255 βˆ’ v . Light areas turn dark, dark areas turn light, and hue relationships are preserved in a rough sense while lightness relations flip.

The trap is assuming that this flips the thing that matters. Readability depends on relative luminance, a single number derived from the three channels after a linearisation step, not on the raw channel values. Two colours can have the same channel values inverted and end up nowhere near a mirrored luminance. So the useful frame is: inversion moves pixels, and luminance is what you then have to re-check.

The thresholds the check is measured against

WCAG 2.2 sets the numbers.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.