mbcahyono
(Muhlis Cahyono)
2019 年 4 月 23 日午前 3:53
1
Following up the discussion here:
Some users have been asking about automatic switching between a light and a dark theme. Could this be accomplished with a plugin?
I assume this would need two parts:
a theme component with a javascript switching themes based on local time
a Discourse plugin adding options to the user preferences page:
turn night mode switching on/off, choose nighttime theme, set time nighttime time period
How difficult would it be to code? As in, how much would it cost?
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
「いいね!」 24
素敵なテーマコンポーネントですね。ただし、有効化の時間範囲を選択できません。このフィールドは米国時間帯のみに対応しているようです。
macOS のライト/ダークモード検出を追加することは可能でしょうか?
「いいね!」 1
ローカル時間を手動で入力できません。何も起こりません。
mbcahyono:
それに関連する別のトピックがあります:
このヒントをありがとうございます!以前からブックマークに入れていました
残念ながら、現在は機能しません。まずトラブルシューティングを行う必要があります…
「いいね!」 2
jrgong
(jrgong)
2020 年 2 月 17 日午前 10:27
6
このテーマコンポーネントと、このコンポーネントを組み合わせることはできますか?
Any thoughts about making the bottom smaller? When using additional component, it takes a lot of space in the header. For example I like the dark mode button in this ghost theme at top right:
そうすれば、ユーザーは必要に応じて自動ダークモードを上書きできます。
「いいね!」 1
mbcahyono
(Muhlis Cahyono)
2020 年 2 月 17 日午前 11:52
7
はい、可能です。ただし、予期しない動作につながる可能性があります。
jrgong
(jrgong)
2020 年 8 月 4 日午後 12:28
8
このコンポーネントに問題があるようです。プロフィール設定で有効にしてページを再読み込みすると、ボックス内のチェックマークが消え、無効化されてしまいます。
@pmusaraj さんは、これよりもさらに自動的な何かを作業中だと考えています。
「いいね!」 4
pmusaraj
(Penar Musaraj)
2020 年 8 月 25 日午後 1:48
10
Core には、デバイスのダークモード UI に基づいた類似の機能が追加されました。詳しくは、自動ダークモードカラーテーマ切り替え をご覧ください。
「いいね!」 4