mbcahyono
(Muhlis Cahyono)
23 Aprile 2019, 3:53am
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 Mi Piace
Bellissimo componente del tema. Ma non riesco a selezionare un intervallo di tempo per l’attivazione. Sembra che il campo sia valido solo per i fusi orari statunitensi?
È possibile aggiungere il rilevamento della modalità chiara/scura di macOS?
1 Mi Piace
mbcahyono
(Muhlis Cahyono)
9 Dicembre 2019, 12:41am
4
Sono certo che sia l’ora locale (del dispositivo).
Esiste un altro tema per questo:
Discourse ora supporta Automatic Dark Mode color scheme switching nel core; questo componente è ora deprecato e non dovrebbe più essere utilizzato.
Repository :
https://github.com/pmusaraj/discourse-dark-mode
Istruzioni per l’installazione: Installing a theme or theme component
Cosa fa?
Questo componente consente il passaggio automatico a un tema scuro quando il browser è impostato sulla modalità scura. Funziona solo per gli utenti registrati su tutti i browser che supportano la q…
5 Mi Piace
Non riesco a inserire manualmente la mia ora locale. Non succede nulla.
Grazie per questo suggerimento! L’avevo già nei miei segnalibri
Purtroppo, al momento non funziona. Devo prima fare un po’ di risoluzione dei problemi…
2 Mi Piace
jrgong
(jrgong)
17 Febbraio 2020, 10:27am
6
È possibile combinare questo componente del tema con questo?
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:
In questo modo, gli utenti potrebbero sovrascrivere la modalità scura automatica, quando desiderato.
1 Mi Piace
mbcahyono
(Muhlis Cahyono)
17 Febbraio 2020, 11:52am
7
Sì, puoi farlo, ma potrebbe causare comportamenti inaspettati.
jrgong
(jrgong)
4 Agosto 2020, 12:28pm
8
Sembra che questo componente sia rotto. Ogni volta che lo abilito nelle impostazioni del mio profilo e ricarico la pagina, la spunta nella casella scompare e viene disabilitato.
Credo che @pmusaraj stia lavorando a qualcosa di ancora più automatico di questo.
4 Mi Piace
pmusaraj
(Penar Musaraj)
25 Agosto 2020, 1:48pm
10
Core ora ha una funzionalità simile basata sull’interfaccia utente in modalità scura del dispositivo; consulta Cambio automatico dello schema colori in modalità scura .
4 Mi Piace