-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Change themes based on the system theme" Option no longer works after latest Firefox update #31
Comments
I found that Firefox, in some scenarios, sets the This happens even if It didn't used to do this. Dark mode in browsers have been changing a lot in software/Firefox in the past few years. Either way, I'm still looking into it. Thanks for letting me know. |
I looked into it further and this seems to be related to how themes (as of Firefox 100) are allowed to set the color scheme: https://bugzilla.mozilla.org/show_bug.cgi?id=1750932 |
Now the bug happens on Firefox Release Version too. |
A so-called “loop” can be replicated this way:
I’m looking for a method to detect OS-level dark mode as well, because my add-on also needs this feature: Adaptive Tab Bar Color. Hope you can figure that out soon. |
I haven't tried to reproduce the loop bug, but indeed the setting to change theme based on the system theme no longer works on the release version of Firefox. |
Not sure if I should mention this. I also found this issue recently and had been doing some tests before I saw the bug report here. In my own tests, I found Dark Reader was able to switch the mode correctly based on OS system theme, while automaticdark had no responce. |
@speakerz It’s a different mechanism. Dark Reader only needs to work on websites where content script can be loaded, so Dark Reader just reads the meta tag in the HTML and gets the color scheme. In the contrary, Time Based Themes needs to work globally throughout the browser, no matter content script is loaded or not. (I’m not totally sure, still testing)
|
Just to add to this, I think that the issue could be that the background pages are unloaded and change events aren't triggered. If I open the background page There's a 3-year old open issue on the Mozilla page about this. Not sure how the "system theme" setting was able to work before, though. |
The original "system theme" of Firefox is also not working, meaning: you have to restart Firefox to apply the theme change. If it does not work out of the box, how can an extension which probably relies on those mechanisms work? I'm not wondering this extension is broken (too), at the same time sorry to see as I was hoping to find a solution with this extension. |
Hm, the "system theme" does work for me, still; it's what I've always been using since AutomaticDark stopped working. With "works", I mean that the preference is respected upon toggling, without restarting the application. Perhaps it depends on the version or OS we're running it on? I am running Firefox 108 on Zorin OS 16, installed through apt. I do have to say: I have installed Stylus as well, and when quickly toggling (1s in between) from light to dark and back, I get a two additional toggles that I never noticed before, so perhaps something did change under the hood of Firefox lately, since the extension wasn't updated since August. |
has anyone found a fix or an alternative? |
Well, I've tried to create my own dynamic theme before to just combine the light and dark themes I wanted to use (Dracula + Light Theme), but it was too much of a hassle to figure those things out as I have very little experience with extensions. I'm not sure, but I believe dynamic themes are more than just a json listing the theme properties; they require a few additional files. You could try inspecting the dynamic Firefox themes such as the "Aplenglow" or the "System theme" if you want your two themes to switch based on the OS's theme and create & install your own. I got stuck somewhere, I believe it was at installing it as an xpi (not just as a developer extension) but it was a while ago, and I've learnt to just accept the "System theme". I'd be happy to look at your project if you get your own theme combo working! ;-) |
I think the problem is this line of code in common.js doesn’t work any more:
When the system colour scheme changes, the meta tag
I think the reason is, when the add-on inquires or listens to the change of the meta tag A possible solution might be: the add-on extracts all colour values of the browser theme, and adds Above are all my personal perspective. Further inspection is required. |
It worked. I set “Daytime theme” to “Light” and “Nighttime theme” to “Dark”: I set “Daytime theme” to “Dark” and “Nighttime theme” to “Light”: My approach is, every time a theme is applied, the add-on set the This is just a demo, which means it’s not perfectly stable: https://github.com/easonwong-de/time-based-themes |
This is brilliant. @easonwong-de , if you're OK with it, can you make a pull request? I still need to test and review the changes, but I think you know that you're solving a long-standing bug. It restores a feature that's been broken for too long. I would like to incorporate your approach, at the very least as an experimental change. One concern I have is that it requires the "theme" permission but I think that's totally reasonable for what the add-on does. To be honest, I'm surprised the add-on has gone so far without needing this permission. Thank you in advance! |
Hi, and thanks for spending your precious time fixing this. |
Hi @khaled-0 , I submitted the next release 1.4.1 to Mozilla on Feb 23rd. It's currently awaiting review. Once it's reviewed and approved, the new update will roll out to everyone. I'll add a new comment here once it's released. :) |
Hey it's approved |
After the latest update of Firefox Developer Edition, The option of changing the themes based on system color scheme doesn't tend to work properly.
Also, When The Daytime theme is set to Dark and the Nighttime theme is set to Light, the extensions goes into a loop of changing themes rapidly.
Other options however, seem to work flawlessly.
Thanks for the great extension.
The text was updated successfully, but these errors were encountered: