mbcahyono
(Muhlis Cahyono)
23.Апрель.2019 03:53:50
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 лайка
terraboss
(Markus)
08.Декабрь.2019 20:26:51
3
Отличный компонент темы. Но я не могу выбрать диапазон времени для активации. Похоже, что поле предназначено только для часовых поясов США?
Возможно ли добавить определение светлого/темного режима macOS?
1 лайк
mbcahyono
(Muhlis Cahyono)
09.Декабрь.2019 00:41:17
4
Я уверен, что это локальное (устройство) время.
Для этого есть другая тема:
5 лайков
terraboss
(Markus)
09.Декабрь.2019 08:35:31
5
Я не могу вручную ввести своё локальное время. Ничего не происходит.
Спасибо за эту подсказку! У меня она уже была в закладках
К сожалению, сейчас это не работает. Мне сначала нужно провести некоторые действия по устранению неполадок…
2 лайка
jrgong
(jrgong)
17.Февраль.2020 10:27:29
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)
17.Февраль.2020 11:52:24
7
Да, можно, но это может привести к непредвиденному поведению.
jrgong
(jrgong)
04.Август.2020 12:28:07
8
Похоже, этот компонент сломан. Всякий раз, когда я включаю его в настройках профиля и обновляю страницу, галочка в поле исчезает, и он отключается.
Полагаю, @pmusaraj работает над чем-то ещё более автоматизированным, чем это.
4 лайка
pmusaraj
(Penar Musaraj)
25.Август.2020 13:48:03
10
В Core теперь есть аналогичная функция, основанная на темном режиме интерфейса устройства. Пожалуйста, ознакомьтесь с автоматическим переключением цветовой схемы темного режима .
4 лайка