#101 Dark mode autodetection does not work

Closed
opened 4 years ago by rugk · 7 comments
rugk commented 4 years ago

prefers-color-scheme is not being honored.

Tested with native dark mode and with my add-on.

Firefox 68

Previous discussion: https://social.wiuwiu.de/@rugk/102135280755268256

`prefers-color-scheme` is not being honored. Tested with native dark mode and with [my add-on](https://addons.mozilla.org/firefox/addon/dark-mode-website-switcher/?src=external-github). Firefox 68 Previous discussion: https://social.wiuwiu.de/@rugk/102135280755268256
Niklas Poslovski commented 4 years ago
Owner

I checked for mistakes and found out what was wrong pretty fast. It's now fixed on the development server and will get into production with the next version. Unfortunately it only works with native dark mode and not with you plugin. window.matchMedia("(prefers-color-scheme:dark)").matches seems to ignore whether your plugin is enabled but I can't do anything about that. That's either a bug in you plugin or in Firefox itself.

I checked for mistakes and found out what was wrong pretty fast. It's now fixed on the development server and will get into production with the next version. Unfortunately it only works with native dark mode and not with you plugin. ```window.matchMedia("(prefers-color-scheme:dark)").matches``` seems to ignore whether your plugin is enabled but I can't do anything about that. That's either a bug in you plugin or in Firefox itself.
rugk commented 4 years ago
Poster

Actually my add-on does indeed fake window.matchMedia("(prefers-color-scheme:dark)").matches. However, I need to look into the details, when I have a running instance with that change.

Actually my add-on does indeed fake `window.matchMedia("(prefers-color-scheme:dark)").matches`. However, I need to look into the details, when I have a running instance with that change.
Niklas Poslovski commented 4 years ago
Owner

At least in my Firefox setup it does not fake window.matchMedia("(prefers-color-scheme:dark)").matches. I typed exactly this command into the Javascript console and with native dark mode it worked well but it totally ignored your plugin.

At least in my Firefox setup it does not fake ```window.matchMedia("(prefers-color-scheme:dark)").matches```. I typed exactly this command into the Javascript console and with native dark mode it worked well but it totally ignored your plugin.
rugk commented 4 years ago
Poster

Is the add-on really enabled? I.e.:


Ah okay, found the issue. It required the space, i.e. try window.matchMedia("(prefers-color-scheme: dark)").matches.

Is the add-on really enabled? I.e.: ![](https://hostux.pics/images/2019/05/25/image33631fb7de66ea13.png) --- Ah okay, found the issue. It required the space, i.e. try `window.matchMedia("(prefers-color-scheme: dark)").matches`.
Niklas Poslovski commented 4 years ago
Owner

I can confirm that it works with the space and fixed it on the development server so that it will work with the next Halcyon version. Anyway that is pretty weird behavior by your plugin as the native dark mode works quite well without the space. Maybe you should fix that problem,too.

I can confirm that it works with the space and fixed it on the development server so that it will work with the next Halcyon version. Anyway that is pretty weird behavior by your plugin as the native dark mode works quite well without the space. Maybe you should fix that problem,too.
rugk commented 4 years ago
Poster

Yep, tracked in https://github.com/rugk/website-dark-mode-switcher/issues/7.

So this here seems to be solved. :smile:

Yep, tracked in https://github.com/rugk/website-dark-mode-switcher/issues/7. So this here seems to be solved. :smile:
rugk commented 4 years ago
Poster
Okay, fixed in https://github.com/rugk/website-dark-mode-switcher/commit/0f1f16697e28356961eae7755bd4a7a963015426, BTW.
Sign in to join this conversation.
No Milestone
No assignee
2 Participants
Loading...
Cancel
Save
There is no content yet.