#101 Dark mode autodetection does not work

Fechado
5 anos atrás foi aberto por rugk · 7 comentários
rugk comentado 5 anos atrás

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 comentado 5 anos atrás
Proprietário

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 comentado 5 anos atrás
Autor

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 comentado 5 anos atrás
Proprietário

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 comentado 5 anos atrás
Autor

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 comentado 5 anos atrás
Proprietário

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 comentado 5 anos atrás
Autor

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 fechado em 5 anos atrás
rugk comentado 5 anos atrás
Autor
Okay, fixed in https://github.com/rugk/website-dark-mode-switcher/commit/0f1f16697e28356961eae7755bd4a7a963015426, BTW.
Faça login para participar desta conversação.
Sem milestone
Não atribuída
2 participantes
Carregando...
Cancelar
Salvar
Ainda não há conteúdo.