# 这仍然是检查暗模式的解决方案吗？

**URL:** <https://meta.discourse.org/t/is-this-still-the-solution-for-checking-for-dark-mode/353354>\
**Category:** Development\
**Created:** [2025年二月20日 15:56 UTC](https://meta.discourse.org/t/is-this-still-the-solution-for-checking-for-dark-mode/353354 "2025-02-20T15:56:12Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)\
**Post date:** [2025年二月20日 17:31 UTC](https://meta.discourse.org/t/is-this-still-the-solution-for-checking-for-dark-mode/353354/2 "2025-02-20T17:31:18Z")

</div>

巧合的是，这正是我们本周内部一直在讨论的事情！这里有几个概念验证 PR：

- [DEV: Introduce `html.dark-mode` and `html.light-mode` classes by davidtaylorhq · Pull Request #31397 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/31397)

- [DEV: Add reactive helpers to `interfaceColor` service by davidtaylorhq · Pull Request #31415 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/31415)

请注意，这些只是帮助我们思考的实验 - 它们不保证会被合并。

至于“现在”，最好的方法可能是使用 `<LightDarkImg` 组件，如下所示：

> <https://github.com/discourse/discourse/blob/a26138b501f19b98f132f749fb5fca11ae04c016/app/assets/javascripts/discourse/app/components/category-logo.gjs#L3C1-L10C13>

---

_[View the full topic](https://meta.discourse.org/t/is-this-still-the-solution-for-checking-for-dark-mode/353354)._
