Documentation
¶
Overview ¶
Command themecheck proves, in a real browser, that the canvas follows the page's theme — both when the reader chooses one and when the machine changes its mind underneath them.
⛔ A VALUE READ ONCE AT START-UP CANNOT FOLLOW A CHANGE, and a check that loads a page once cannot see whether it did. cmd/pagecheck asks Chrome for a single screenshot and judges it, which is the right shape for "did the editor draw"; it is the wrong shape for this, because the defect this guards is invisible until something changes AFTER the page has settled.
So the three states are driven, in order, on one loaded page:
light the system setting, emulated the canvas is light dark the system setting, changed the canvas turns dark data-theme the reader's toggle, written the canvas turns light
The second proves the prefers-color-scheme listener, the third the MutationObserver. Before the listeners existed the canvas held whatever it read in main() and both of the last two rows failed.