Skip to content

chore: 优化深色模式主题并新增返回顶部按钮#997

Merged
joesdu merged 2 commits intomainfrom
dev
Oct 29, 2025
Merged

chore: 优化深色模式主题并新增返回顶部按钮#997
joesdu merged 2 commits intomainfrom
dev

Conversation

@joesdu
Copy link
Copy Markdown
Owner

@joesdu joesdu commented Oct 29, 2025

📝 描述 (Description)

更改深色模式配色为 Dracula 主题,提升视觉效果和可读性。
调整滚动条、按钮、焦点阴影及 HTTP 方法块的样式。
新增返回顶部按钮,支持平滑滚动并动态显示/隐藏。
优化主题切换按钮,改用 SVG 图标并移至顶部导航栏。
改进代码结构和注释,增强可维护性。

🔗 相关问题 (Related Issues)

  • Closes #
  • Fixes #

🏷️ 变更类型 (Type of Change)

  • 🐛 错误修复 (Bug fix) (non-breaking change which fixes an issue)
  • ✨ 新功能 (New feature) (non-breaking change which adds functionality)
  • 💥 破坏性变更 (Breaking change) (fix or feature that would cause existing functionality to not work as expected)
  • 📚 文档更新 (Documentation update)
  • 🔧 重构 (Refactor) (no functional changes)
  • 🧪 测试 (Tests) (adding or updating tests)
  • 🛠️ 构建/CI 变更 (Build/CI changes)
  • 🎨 样式变更 (Style changes) (formatting, etc.)
  • 🚀 性能改进 (Performance improvements)
  • 🔒 安全改进 (Security improvements)

✅ 检查清单 (Checklist)

  • 我的代码遵循项目的编码标准 (My code follows the project's coding standards)
  • 我已经对自己的代码进行了自我审查 (I have performed a self-review of my own code)
  • 我已经在难以理解的区域注释了我的代码 (I have commented my code, particularly in hard-to-understand areas)
  • 我已经对文档进行了相应的更改 (I have made corresponding changes to the documentation)
  • 我的更改不会产生新的警告或错误 (My changes generate no new warnings or errors)
  • 我已经添加了证明我的修复有效或我的功能工作的测试 (I have added tests that prove my fix is effective or that my feature works)
  • 新增和现有的单元测试在本地通过我的更改 (New and existing unit tests pass locally with my changes)
  • 任何依赖变更都已合并并发布到下游模块 (Any dependent changes have been merged and published in downstream modules)

🧪 测试 (Testing)

  • 单元测试 (Unit tests)
  • 集成测试 (Integration tests)
  • 手动测试 (Manual testing)
  • 其他 (请指定) (Other (please specify)):

📸 截图 (如果适用) (Screenshots (if applicable))

🔍 附加说明 (Additional Notes)

更改深色模式配色为 Dracula 主题,提升视觉效果和可读性。
调整滚动条、按钮、焦点阴影及 HTTP 方法块的样式。
新增返回顶部按钮,支持平滑滚动并动态显示/隐藏。
优化主题切换按钮,改用 SVG 图标并移至顶部导航栏。
改进代码结构和注释,增强可维护性。
Copilot AI review requested due to automatic review settings October 29, 2025 08:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the Swagger UI customization by replacing emoji icons with SVG graphics and adding a back-to-top button feature. The theme has also been updated from GitHub Dark to Dracula color scheme.

  • Replaced emoji icons (🌙, ☀️) with scalable SVG icons for better cross-platform compatibility
  • Added a new back-to-top button that appears when scrolling down
  • Changed theme color scheme from GitHub Dark to Dracula Theme

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
theme-toggle.js Replaced emoji icons with SVG graphics for theme toggle button; added new back-to-top button functionality with scroll detection
custom.css Updated color scheme from GitHub Dark to Dracula Theme; added styling for the back-to-top button; repositioned theme toggle button

Comment thread sample/WebApi.Test.Unit/wwwroot/swagger-ui/theme-toggle.js
Comment thread sample/WebApi.Test.Unit/wwwroot/swagger-ui/theme-toggle.js Outdated
Comment thread sample/WebApi.Test.Unit/wwwroot/swagger-ui/custom.css
Comment thread sample/WebApi.Test.Unit/wwwroot/swagger-ui/custom.css
Comment thread sample/WebApi.Test.Unit/wwwroot/swagger-ui/custom.css
添加了一个通用的 `throttle` 函数,用于限制函数调用频率。
将滚动事件监听器的回调提取为 `handleScroll` 函数,并通过
`throttle` 函数对其进行节流处理,减少滚动事件触发频率。
代码结构更加清晰,性能得到优化。
@joesdu joesdu merged commit a6e070e into main Oct 29, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants