mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-15 22:08:03 +00:00
Adds --contrast flag to the validate command. When enabled, after the standard console-error check, the command: 1. Reads composition duration from window.__hf or data-duration attribute 2. Seeks to 5 evenly-spaced timestamps via the runtime seek protocol 3. Takes a screenshot at each timestamp 4. Injects a browser-side audit script that walks the DOM for text elements, samples background pixels via canvas from the screenshot, and computes WCAG 2.1 contrast ratios 5. Reports failures as CLI errors with selector, text, ratio, and timestamp Zero new Node dependencies — all pixel work runs in the browser via canvas getImageData. The WCAG math is injected as a raw script string to avoid esbuild transform issues with page.evaluate. Usage: hyperframes validate --contrast hyperframes validate --contrast --json Contrast failures exit with code 1, same as console errors.