Coder Social home page Coder Social logo

Comments (8)

rugk avatar rugk commented on June 3, 2024 1

Indeed I have the same hope and once https://bugzilla.mozilla.org/show_bug.cgi?id=1547818 is solved this add-on can be trivially adjusted to always work and we would not have to care about these strange bugs.
(Note for now you can also use an about:config entry to toggle that. Just FYI.)

from website-dark-mode-switcher.

rugk avatar rugk commented on June 3, 2024

Looks like this in v ccb9911 in my testing:

Is not this what you expect?

from website-dark-mode-switcher.

rugk avatar rugk commented on June 3, 2024

Ah okay, so you expect no background in small windows there?

Well… yeah… I see the problem and your provided solution would be the only one I can imagine.

Feel free to submit a PR.

from website-dark-mode-switcher.

rugk avatar rugk commented on June 3, 2024

Though I have to say injecting the whole CSS again could also break things, e.g.:

  • if there are other CSS files that take precedence that do not contain any prefers-color-scheme. They would not be recognized.
  • If CSS styles are dynamically adjusted by JS, the add-on could overwrite these accidentally with it's own injected styles from the website's stylesheets.
  • possibly more 🤔

So maybe that's not a good idea. 🤔

from website-dark-mode-switcher.

Sysix avatar Sysix commented on June 3, 2024

if there are other CSS files that take precedence that do not contain any prefers-color-scheme. They would not be recognized.

I though about replace the prefer-color-scheme: dark media query with the own content.
When the User switch back to Light theme, We can replace to orginal (in variable / cache) file

If CSS styles are dynamically adjusted by JS, the add-on could overwrite these accidentally with it's own injected styles from the website's stylesheets.

Javascript Changes should add a "style" attribute. And style Attributes are always prioritized. (Expect !important)

possibly more 🤔

Jeah possible


Another Solution (don't know if is possible):

Learn the Browser the media Query (if not already known) and set the prefer-color-scheme before parsing the CSS Files. Then the extraction could be removed

from website-dark-mode-switcher.

rugk avatar rugk commented on June 3, 2024

Your alternative solution is not possible, but the replacement basically is already done.Just not the whole file. Well… as said, you could hack around, try it out and send a PR if it works. 😃

See https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/insertCSS on how it basically works/for the API you need to use.

from website-dark-mode-switcher.

Sysix avatar Sysix commented on June 3, 2024

I'm sorry, I don't have enough time to test/check this problem. For me it works on a real-life device (Chrome Mobile on Android 8). So when firefox (with your Plugin) has Problems, I don't really matter :). (sorry).

I hope that Mozilla will at a native Button / Option for that and don't need another Plugin to activate Dark Mode.

from website-dark-mode-switcher.

rugk avatar rugk commented on June 3, 2024

Hi, I have great news for you! According to my testing, the latest v2.0 release fixes this issue due to the way it now uses a completely new API to do "dark-mode-changing" "properly". For more information, please see the release notes. If the issue should not be fixed, please let me know.

from website-dark-mode-switcher.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.