
How to test dark mode rendering across devices automatically
How to Test Dark Mode Rendering Across Devices Automatically Dark mode bugs are the last to get caught: a white background that didn't invert, text that vanishes against a dark surface, an image with a hardcoded light background. They only surface when a user on dark mode reports them — or when you look at your app on your phone at night. Here's how to screenshot your pages in both modes across multiple viewports automatically, so you catch these before users do. Light vs dark — side by side const PAGEBOLT_API_KEY = process . env . PAGEBOLT_API_KEY ; async function screenshotBothModes ( url ) { const [ light , dark ] = await Promise . all ([ captureScreenshot ( url , { darkMode : false }), captureScreenshot ( url , { darkMode : true }), ]); return { light , dark }; } async function captureScreenshot ( url , options = {}) { const res = await fetch ( " https://pagebolt.dev/api/v1/screenshot " , { method : " POST " , headers : { " x-api-key " : PAGEBOLT_API_KEY , " Content-Type " : " appl
Continue reading on Dev.to Webdev
Opens in a new tab


