feat: 在设置页面添加主题切换按钮#18
Merged
Merged
Conversation
Allow users to switch between light/dark/auto themes via localStorage, instead of relying solely on OS prefers-color-scheme.
Merged
Owner
|
主题设置不应该在需要登录的区域(user_settings),否则未登录的用户就无法切换主题。更合适的地方应该是导航栏上。 |
根据 review 反馈,主题切换不应在需要登录的设置页面, 改为导航栏右侧图标按钮,未登录用户也可使用。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
forum/templates/base.html: 重构主题初始化脚本,支持 localStorage 覆盖系统偏好;将 CSS 暗色背景从@media查询改为[data-bs-theme="dark"]选择器forum/templates/forum/user_settings.html: 新增主题设置区域,使用 Bootstrap btn-group 单选按钮组Test
在本地开发服务器上手动测试通过,三种主题模式均可正常切换并持久化。