rugk / website-dark-mode-switcher

This is a (Firefox) add-on (WebExtension) that lets you invert the website's color scheme by inverting/changing the prefers-color-scheme media feature of CSS.
https://addons.mozilla.org/firefox/addon/dark-mode-website-switcher/?src=external-github-top
Other
58 stars 4 forks source link

Doesn't work with stylesheets imported with @import #28

Closed Justin-CB closed 3 years ago

Justin-CB commented 3 years ago

Affected website: justinbesterportfolio.xp3.biz

Bug description

Extension fails to recognize the dark mode css.

Steps to reproduce

  1. Install dark mode forcer
  2. Enable dark mode forcer
  3. Goto justinbesterportfolio.xp3.biz

    Actual behavior

    The website displays in light mode despite having dark mode CSS.

    Expected behavior

    The website will style using the dark mode CSS.

    System

    Operating system and version: Browser and version: Firefox Add-on version:

    Possible solution

rugk commented 3 years ago

Oh I'm sorry, I debugged this your assessment was indeed correct, the cause for this issue is the @imported style. It was in my mind that the browser would parse that correctly, but it does not.

rugk commented 3 years ago

So thanks for the report, this should be fixed in https://github.com/rugk/website-dark-mode-switcher/commit/fa7086ef875eaf350b605cc55f1db914c4a31b00, where I now recursively parse the stylesheets for such things.

Note you could try out the development version and report back whether it/everything works/you like it or what may still be adjusted, so I can do this before the next release. In case there is something to be done… :smile: