为什么`````'window.matchmedia('(prefers-color-scheme:dark)')。
我正在使用ubuntu,并尝试通过使用 matchmedia
来获取用户的首选主题,但它总是返回此查询的 false
。
window.matchMedia('(prefers-color-scheme: dark)').matches // false
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个 opar nore noreferrer“> opar opares esloge chrome in Chrome in Chrome 。
This is an open issue in Chrome.
这是Ubuntu和Chrome之间的问题。请检查Darkmood使用Ubuntu和Firefox切换。然后,您可以看到它在没有任何问题的情况下工作。
这就是为什么我认为这是Ubuntu和Chrome之间的问题。
这是一个已知的问题,可以通过此页面 。
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.