为什么`````'window.matchmedia('(prefers-color-scheme:dark)')。

发布于 2025-01-22 00:15:00 字数 185 浏览 2 评论 0 原文

我正在使用ubuntu,并尝试通过使用 matchmedia 来获取用户的首选主题,但它总是返回此查询的 false

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

聊慰 2025-01-29 00:15:00

这是一个 opar nore noreferrer“> opar opares esloge chrome in Chrome in Chrome 。

This is an open issue in Chrome.

人生戏 2025-01-29 00:15:00

这是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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文