添加明暗模式切换器 (Add Dark/Light Mode Switcher)#8
Draft
Copilot wants to merge 3 commits into
Draft
Conversation
Co-authored-by: NoRainLand <66503849+NoRainLand@users.noreply.github.com>
Co-authored-by: NoRainLand <66503849+NoRainLand@users.noreply.github.com>
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.
概述 (Overview)
实现了完整的明暗模式切换功能,允许用户在浅色和深色主题之间无缝切换,并自动保存用户偏好设置。
Implemented a complete dark/light mode switcher that allows users to seamlessly toggle between light and dark themes with automatic preference persistence.
✨ 新功能 (New Features)
🎨 主题系统 (Theme System)
🌓 主题切换按钮 (Theme Toggle)
💾 偏好持久化 (Preference Persistence)
🎨 配色方案 (Color Schemes)
浅色主题 (Light Theme):
#f5f0d3(温暖的米色)#692612(深棕色)#000000(黑色)深色主题 (Dark Theme):
#2a2a2a(深灰色)#8b4513(棕色强调)#ffffff(白色)🔧 技术实现 (Technical Implementation)
CSS 变量系统
扩展的 SwitchStyle 类
📱 界面截图 (UI Screenshots)
浅色主题 (Light Theme):

深色主题 (Dark Theme):

🛠️ 使用方法 (Usage)
用户可以通过点击右上角的太阳/月亮图标在主题间切换。选择的主题会自动保存并在后续访问时恢复。
Users can toggle between themes by clicking the sun/moon icon in the top-right corner. The selected theme is automatically saved and restored on subsequent visits.
📁 修改的文件 (Modified Files)
src/SwitchStyle.ts- 扩展主题切换功能src/css/desktop/Common.scss- 添加 CSS 变量和 z-indexsrc/css/mobile/Common.scss- 移动端 CSS 变量src/css/desktop/MainPage.scss- 桌面端主题样式src/css/mobile/MainPage.scss- 移动端主题样式src/css/desktop/Sidebar.scss- 侧边栏主题适配src/css/mobile/Sidebar.scss- 移动端侧边栏适配bin/index.html- 添加主题切换按钮src/index.ts- 集成 SwitchStyle 类src/libs.d.ts- 增强 TypeScript 类型定义⚡ 性能优化 (Performance)
🧪 测试 (Testing)
已通过功能演示验证:
Verified through functional demo:
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
registry.npmmirror.comnpm install(dns block)npm install mime-types(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.