You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Changes
- Replaced pixel-based visual regression tests for dark/light mode with
perceptually accurate brightness assertions.
- Implemented a `getPageBrightness()` helper that computes **relative
luminance** using the ITU-R BT.709/sRGB coefficients (`0.2126*R +
0.7152*G + 0.0722*B`), normalized to the `[0, 1]` range.
- Added assertions that light mode brightness is approximately `0.85 ±
0.1` and dark mode is `0.25 ± 0.1`.
- Removed all stored screenshot snapshots for dark/light mode across
browsers and devices.
## Context
Pixel-diff-based screenshot tests are fragile they fail on minor layout
shifts, anti-aliasing changes, or browser rendering differences, even
when the visual theme (light/dark) is correct.
One example is the PR where the monitor around Git's version number
is removed, which caused the dark mode tests to fail, even though the
new look did not change anything about how dark the dark mode is.
Instead, we now verify **perceived brightness** using the standard
definition of *relative luminance* from color science (per
[Wikipedia](https://en.wikipedia.org/wiki/Relative_luminance)), which
aligns with human vision sensitivity (green contributes most, blue
least).
Reference:
#2088 (comment)
0 commit comments