Feat(webui): improve code block readability in dark mode(iss#6963)#7014
Feat(webui): improve code block readability in dark mode(iss#6963)#7014RC-CHN merged 2 commits intoAstrBotDevs:masterfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求旨在解决暗色模式下代码块文本可读性差的问题。通过引入新的全局CSS样式,统一了代码块的字体并调整了颜色,显著提升了用户在深色主题下阅读代码的体验。 Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The global
pre, code, ...selector will apply in both light and dark themes; consider scoping these overrides under the dark-mode root class (or theme variable) so light mode code blocks are not unintentionally affected. - Forcing
color: #111827on allpre/codeelements will override any syntax highlighting colors; if highlighting is desired, limit the rule to specific containers (e.g., markdown code blocks) or only adjust background/contrast rather than a single hard-coded text color. - Instead of a hard-coded
#111827, consider using the existing design tokens or CSS variables for text colors so the code block text stays consistent with the rest of the dark theme palette and can be adjusted centrally.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The global `pre, code, ...` selector will apply in both light and dark themes; consider scoping these overrides under the dark-mode root class (or theme variable) so light mode code blocks are not unintentionally affected.
- Forcing `color: #111827` on all `pre`/`code` elements will override any syntax highlighting colors; if highlighting is desired, limit the rule to specific containers (e.g., markdown code blocks) or only adjust background/contrast rather than a single hard-coded text color.
- Instead of a hard-coded `#111827`, consider using the existing design tokens or CSS variables for text colors so the code block text stays consistent with the rest of the dark theme palette and can be adjusted centrally.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Code Review
This pull request introduces styling for code blocks and preformatted text elements, setting a specific font family and color. However, the hardcoded color value will negatively impact readability in dark mode. It is recommended to use a Vuetify theme variable for the color to ensure proper adaptation across different themes.
| pre, code, .markdown pre, .markdown code, .release-notes pre, .release-notes code { | ||
| font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Roboto Mono", "Helvetica Neue", monospace; | ||
| color: #111827; | ||
| } |
There was a problem hiding this comment.
While the intention is to improve readability in dark mode, setting the color to the hardcoded value #111827 will have the opposite effect. This color is very dark and will be nearly invisible on a dark background, which contradicts the goal of this pull request.
To correctly support both light and dark themes, you should use Vuetify's theme system. By using a theme variable like rgb(var(--v-theme-on-surface)), the text color will adapt automatically to the current theme, ensuring readability in both modes.
| pre, code, .markdown pre, .markdown code, .release-notes pre, .release-notes code { | |
| font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Roboto Mono", "Helvetica Neue", monospace; | |
| color: #111827; | |
| } | |
| pre, code, .markdown pre, .markdown code, .release-notes pre, .release-notes code { | |
| font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Roboto Mono", "Helvetica Neue", monospace; | |
| color: rgb(var(--v-theme-on-surface)); | |
| } |
Modifications / 改动点
Fixes [Feature]WebUI深色配色下更新日志的行内代码块内容可读性极差,希望修改相关配色 #6963
Screenshots or Test Results / 运行截图或测试结果
Checklist / 检查清单
😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
/ 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。
👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
/ 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。
🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in
requirements.txtandpyproject.toml./ 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到
requirements.txt和pyproject.toml文件相应位置。😮 My changes do not introduce malicious code.
/ 我的更改没有引入恶意代码。
Summary by Sourcery
Enhancements: