Can WebExtensions actually somehow overwrite the result of a media query?
I mean, for JS window.matchMedia() this is likely easy: Just inject a content script that overwrites that JS function.
But if “real” CSS media queries (inside css files) are used, this is not really possible, is it?
Some background: If you wonder why, my use case would be to overwrite the new prefers-color-scheme CSS media feature introduced in Firefox 67. (It’s not currently available for any other browsers that support browser/WebExtensions.)
I’ve finally made it and published a “proof-of-concept”-like add-on on AMO, so try it out, (source on GitHub), but it really was not a pleasant experience. At least the add-on can actually overwrite the mode to dark for the websites, I’ve tested it.
Basically I needed extract the CSS manually and manually apply it. (Not-so-easy JS overwrite needed, too, BTW…)
Am I correct in assuming that these limitations prevent your Dark Website Forcer extension from firing a media change event when I toggle the extension?