This article misses the easiest way to test sites with forced-colors. Microsoft Edge has a forced-colors user feature in settings, called Page colors. The feature is available in Microsoft Edge for Windows, macOS, and Linux.
Edge's Page colors has the same theme options as Windows Contrast themes, plus a White theme. What it doesn't have is Windows's option to create a custom theme. Originally the feature had a bug in that it didn't automatically make `prefers-color-scheme` match the dark or light theme but that was recently resolved in Edge 157.
Regarding using Playwright to perform visual regression tests for forced-colors, I suggest running it twice, once with `colorScheme: 'dark'`, once with `colorScheme: 'light'`; there will be issues that only affect dark or light forced-color themes.
The article covers using Firefox. It does the job and while it's nice that you can change the Canvas, CanvasText, and Link colors to whatever you want, it's much slower to do that to test both light and dark forced colors.
I just did forced color testing and fixed a bunch of issues on my site. I was surprised at how few changes I needed to make to get it looking decent and working well. Props to the browser folks who clearly busted their asses to come up with ways to build this stuff without it being an utter disaster out of the box.
This article misses the easiest way to test sites with forced-colors. Microsoft Edge has a forced-colors user feature in settings, called Page colors. The feature is available in Microsoft Edge for Windows, macOS, and Linux.
Edge's Page colors has the same theme options as Windows Contrast themes, plus a White theme. What it doesn't have is Windows's option to create a custom theme. Originally the feature had a bug in that it didn't automatically make `prefers-color-scheme` match the dark or light theme but that was recently resolved in Edge 157.
Regarding using Playwright to perform visual regression tests for forced-colors, I suggest running it twice, once with `colorScheme: 'dark'`, once with `colorScheme: 'light'`; there will be issues that only affect dark or light forced-color themes.
https://explore.microsoft.com/en-us/edge/features/page-color...
It's also possible to test in Firefox fairly easily
The article covers using Firefox. It does the job and while it's nice that you can change the Canvas, CanvasText, and Link colors to whatever you want, it's much slower to do that to test both light and dark forced colors.
I just did forced color testing and fixed a bunch of issues on my site. I was surprised at how few changes I needed to make to get it looking decent and working well. Props to the browser folks who clearly busted their asses to come up with ways to build this stuff without it being an utter disaster out of the box.