自动夜间模式组件

Following up the discussion here:

I made a theme component that will automatically switch to night theme based on user preferences. It’s currently work on a per-browser basis.

Repository

https://github.com/muhlisbc/discourse-automatic-night-mode-theme

Screenshot:

Installation

Add this component to each theme installed.

Known Issues

  • I’ve received a report of the component making all navigation cause full reloads. Upon navigating between different pages every click caused a full refresh instead of an in-app navigation. I have not been able to reproduce this, so please post reproduction steps if you run into this.

Feedback is welcome and thanks to Discourse team for sponsoring this work :slight_smile:

24 个赞

Nice theme component. But I can’t choose a time range for activation. It seems the field is for US time zones only?

Is it possible to add macOS Light/Dark mode detection?

1 个赞

I’m sure it’s local (device) time.

There is another theme for that:

5 个赞

I can’t enter my local time manually. Nothing happens.

Thanks for this hint! I’ve had this in my bookmarks before :see_no_evil:

Unfortunately, it doesn’t work right now. I need to some troubleshooting first…

2 个赞

这个主题组件可以与另一个组合吗?

这样用户就可以在需要时覆盖自动暗色模式。

1 个赞

可以,但这可能会导致意外行为。

看起来这个组件出问题了。每次我在个人资料设置中启用它并刷新页面后,复选框中的勾选标记就会消失,并且它会被禁用。

我相信 @pmusaraj 正在开发比这更加自动化的东西。

4 个赞

Core 现在基于设备的深色模式 UI 提供了类似的功能,请参阅 自动深色模式配色方案切换

4 个赞