-
Notifications
You must be signed in to change notification settings - Fork 854
fix: DC-4818 Add default color for code blocks' span #7080
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdds a CSS rule setting color: var(--primary-font-color) for .codeBlockLines > span in CodeBlock content styles. No structural or logic changes. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Suggested reviewers
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
Deploying docs with
|
| Latest commit: |
aedfa05
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f1b2b5c5.docs-51g.pages.dev |
| Branch Preview URL: | https://fix-dc-4818-update-code-fcol.docs-51g.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/theme/CodeBlock/Content/styles.module.scss (1)
31-34: Add fallbacks in var() to avoid silent no-op if --primary-font-color is undefinedGood addition. To make this more resilient across themes, add a fallback chain so we gracefully fall back to Prism’s base code color or inheritance if
--primary-font-colorisn’t defined.- color: var(--primary-font-color); + color: var(--primary-font-color, var(--prism-color, inherit));
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
src/theme/CodeBlock/Content/styles.module.scss(1 hunks)
🔇 Additional comments (2)
src/theme/CodeBlock/Content/styles.module.scss (2)
31-34: LGTM on intent: minimal FOUC while token highlighting resolvesSelector scope and cascade behavior align with the goal: default line color until inline token colors apply. Non-invasive and consistent with existing theme vars.
31-34: Verify theme variable definitions and contrast for code blocks
- Confirm that
--primary-font-coloris indeed declared insrc/css/theming.cssfor both modes (light usesvar(--gray-800), dark usesrgb(247,250,252)).- Note that
--prism-background-colorand--prism-coloraren’t defined in our repo’s CSS—they come from the Prism theme shipped by Docusaurus. Please verify those variables are loaded at runtime.- In your browser’s devtools (light + dark), inspect a code block’s computed
background-color/colorto ensure the contrast ratio meets WCAG AA.- Finally, verify that Prism’s
.tokenselectors (and any inlinestyle="color:…"on<span>) still override the base> spanrule as intended.
Redirect checkThis PR probably requires the following redirects to be added to static/_redirects:
|
Dangerous URL checkNo absolute URLs to prisma.io/docs found. |
Color on code's
spans is defined inline, in order to get token highlighting working.From reports on the issue/slack thread, it seems that this highlighting was taking a bit more time to resolve, so I've added a default color to fall back on, which is the most contrasting for both light and dark mode.
This should minimise the visual impact.
Fixes #DC-4818
Summary by CodeRabbit