Home > Software design >  Why `window.matchMedia('(prefers-color-scheme: dark)').matches` returns `false` in Ubuntu
Why `window.matchMedia('(prefers-color-scheme: dark)').matches` returns `false` in Ubuntu

Time:04-18

I'm using Ubuntu and trying to get the preferred theme of the user, by using matchMedia but it always returns false for this query.

window.matchMedia('(prefers-color-scheme: dark)').matches // false

CodePudding user response:

This is an open issue in Chrome.

CodePudding user response:

This is a problem between Ubuntu and Chrome. Please check darkmood toggle with Ubuntu and Firefox. Then you can see it’s working without any issue.

So that's why I think it's a problem between Ubuntu and Chrome.

This is a known issue that is traceable through this page.

  • Related