Fix markdown code block text visibility in light mode#155
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the UI markdown styling to ensure code blocks have readable text color in light mode by explicitly setting color on pre/code elements within markdown-rendered content.
Changes:
- Set
color: var(--text-primary)on.markdown-body pre. - Add explicit
color: var(--text-primary)for.markdown-body pre codeand.markdown-code-block pre code.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/ui/src/styles/markdown.css
Outdated
| .markdown-body pre code, | ||
| .markdown-code-block pre code { |
There was a problem hiding this comment.
This selector applies color: var(--text-primary) to all code inside .markdown-code-block, including Shiki-highlighted output. That can override the intended Shiki theme base color on the <code> element (even if <pre> has an inline color), and may reduce highlight fidelity. Align with the pattern used in messaging/tool-call.css by targeting only non-Shiki blocks (e.g., pre:not(.shiki) code) or adding a more specific rule to preserve Shiki colors.
| .markdown-body pre code, | |
| .markdown-code-block pre code { | |
| .markdown-body pre:not(.shiki) code, | |
| .markdown-code-block pre:not(.shiki) code { |
|
Thanks @seanburkes for fixing this |
|
Review the changes |
|
Reviewed the CSS changes in Looks solid overall:
Small nits / things to double-check:
If those checks look good in both themes, this is LGTM from me. -- |
|
Raise a PR with suggested changes |
|
Opened a PR with the suggested nit applied:
If you’d prefer this as a follow-up commit on the original contributor PR instead of a separate PR, tell me which branch to target and I’ll redo it that way. -- |
|
@seanburkes - Would you be able to check if #163 changes are as expected? |
|
@shantur - I pulled in the AI changes, but still required more work to get the table fixed properly. Visual checks in both light and dark modes, wide and narrow screens, for tables, diagnostics, and code blocks. Looks much better and more consistent now. |


Before, the invisible text in light mode:

After:

And regression testing on dark mode checks out:
