New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dark or light mode handling #690
Comments
My experience is for troubleshooting issues like this, using the I don't know of a way to change this through the import puppeteer from 'puppeteer';
import pa11y from 'pa11y';
const runPa11y = async (url, colorScheme) => {
const page = await browser.newPage();
await page.emulateMediaFeatures([
{ name: 'prefers-color-scheme', value: colorScheme }
]);
const results = await pa11y(url, {
browser,
page,
screenCapture: `pa11y-${colorScheme}.png`
});
await page.close();
return results;
};
const url = 'https://github.com/pa11y/pa11y/';
const testCases = [
{ url, colorScheme: 'dark' },
{ url, colorScheme: 'light' }
];
const browser = await puppeteer.launch();
const results = await Promise.all(
testCases.map(async ({ url, colorScheme }) => {
await runPa11y(url, colorScheme);
})
);
// do something with results
await browser.close(); It does seems like adding a dedicated option to simplify this would be beneficial, especially for something many users are likely to want. |
Chome seems to have a
Is there a way to make use of that with pa11y? |
Expected behaviour
The tool should print, if it's using a dark desktop or a light desktop (and therefore chrome)
It would also be nice, to pass parameters, to change which one it's using.
Actual behaviour
There is no way to tell, if it scans the light or the dark version of my website
Steps to reproduce
npx pa11y https://flathub.org
Environment
The text was updated successfully, but these errors were encountered: