Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

服务端(后端)增加深色模式 #790

Closed
aaro-n opened this issue Mar 5, 2024 · 4 comments
Closed

服务端(后端)增加深色模式 #790

aaro-n opened this issue Mar 5, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@aaro-n
Copy link

aaro-n commented Mar 5, 2024

问题描述

前端可以通过增加darkMode: 'auto',来控制Artalk的深/浅变化,当前端Artalk是深色时,访问Artalk后端还是浅色的,我希望后端也能跟随浏览器变成深色。

测试

在服务端添加变量ATK_FRONTEND_DARKMODE = "'auto'"重新部署后,这个变量未起作用,并且如果前端配置使用后端的参数配置,Artalk前端保持浅色,必须增加darkMode: 'auto',后,才会在浏览器为深色模式下切换为深色。

参考

https://artalk.js.org/guide/frontend/config.html#darkmode

@dianso
Copy link

dianso commented Mar 6, 2024

最好是增加个emoji图标,点击切换,状态存储在浏览器本地。

@qwqcode qwqcode added the bug Something isn't working label Apr 25, 2024
@qwqcode
Copy link
Member

qwqcode commented Apr 27, 2024

你好,新版已修复支持在配置文件中设置 frontend.darkModeauto 启用前端的自动切换夜间模式。

可以在控制中心的设置:界面配置 > 夜间模式 修改为 auto 来启用这个功能。

感谢反馈!


另:环境变量 ATK_FRONTEND_DARKMODE 设置配置文件的 frontend 字段暂时还有问题,因为大小写,环境变量全是大写,前端配置有大小写,笨方法是写死,但是前端配置太多了,有点麻烦,还没来得及修 😢

@qwqcode
Copy link
Member

qwqcode commented May 9, 2024

你好,v2.8.6 刚刚发布了,包含了这个更新,感谢反馈!

@aaro-n
Copy link
Author

aaro-n commented May 9, 2024

已经测试2.8.6版本,之前提的问题有2个:
1.前端读取后端的配置参数,并启用深色模式,这个2.8.6版本已经解决这个问题。
2.后端自己根据配置参数及浏览器的深浅变化,决定后端是否也切换为深色模式,这个2.8.6版本未适配这个问题。

我之所以想要后端也能切换深色模式,是因为在夜间浏览已经适配深色模式的网页,访问Artalk后端网址,显示的网址突然变白,眼睛很不适应,想了下,访问Artalk后端次数很少,问题2没必要开发者耗费精力。
此问题关闭。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants