Skip to content

fix: improve light theme code block variable contrast - #2373

Open
Ibochkarev wants to merge 1 commit into
nuxt:mainfrom
Ibochkarev:fix/issue-2217-codeblock-light-contrast
Open

fix: improve light theme code block variable contrast#2373
Ibochkarev wants to merge 1 commit into
nuxt:mainfrom
Ibochkarev:fix/issue-2217-codeblock-light-contrast

Conversation

@Ibochkarev

Copy link
Copy Markdown
Contributor

🔗 Linked issue

Fixes #2217

📚 Description

On the light theme, Material Theme Lighter paints variables and comments the same gray (#90A4AE), so names like data and signal look muted on docs pages.

I added a small patched theme that keeps comments muted and darkens other #90A4AE tokens (plus default foreground) to #455A64, then wired it in for content highlighting and the MDC parser. Dark theme stays material-theme-palenight.

@vercel

vercel Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

@Ibochkarev is attempting to deploy a commit to the Nuxt Team on Vercel.

A member of the Team first needs to authorize it.

@Ibochkarev
Ibochkarev marked this pull request as ready for review August 9, 2026 01:42
@Ibochkarev
Ibochkarev requested a review from atinux as a code owner August 9, 2026 01:42
@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a local material-theme-lighter-contrast theme derived from Material Theme Lighter. The theme changes the editor foreground and selected muted token colors while excluding comments and docstrings. The Markdown parser and Nuxt configuration now use the custom theme for light and default highlighting. The Palenight dark theme remains unchanged.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: improving variable contrast in light-theme code blocks.
Description check ✅ Passed The description directly explains the contrast issue, the patched theme, and the affected light and dark theme configurations.
Linked Issues check ✅ Passed The changes address issue #2217 by increasing light-theme variable contrast while keeping comments muted.
Out of Scope Changes check ✅ Passed All changes support the linked issue by defining and applying the patched light syntax-highlighting theme.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
themes/material-theme-lighter-contrast.mjs (1)

12-26: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add regression coverage for comment and docstring preservation.

Test default, variable, comment, and docstring token scopes. This protects the contrast rule from changing comment colors in future theme updates.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@themes/material-theme-lighter-contrast.mjs` around lines 12 - 26, Add
regression tests for patchTokenColors covering default, variable, comment, and
docstring token scopes. Verify that the contrast transformation preserves
comment and docstring colors while applying the expected foreground adjustment
only to eligible non-comment tokens.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@themes/material-theme-lighter-contrast.mjs`:
- Around line 12-26: Add regression tests for patchTokenColors covering default,
variable, comment, and docstring token scopes. Verify that the contrast
transformation preserves comment and docstring colors while applying the
expected foreground adjustment only to eligible non-comment tokens.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 685db608-184c-4be9-bd5c-cd6819fe31a1

📥 Commits

Reviewing files that changed from the base of the PR and between 29e59bb and aff48e9.

📒 Files selected for processing (3)
  • helpers/mdc-parser.mjs
  • nuxt.config.ts
  • themes/material-theme-lighter-contrast.mjs

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.

Code block color issue in the light theme on nuxt.com/docs

1 participant