Skip to content

fix(ui): follow the host theme when style variables are missing - #406

Merged
Waishnav merged 1 commit into
mainfrom
fix/card-host-theme
Oct 26, 2026
Merged

Waishnav merged 1 commit into
mainfrom
fix/card-host-theme

Conversation

@Waishnav

@Waishnav Waishnav commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

A host that sends theme: "light" but no styles.variables got a dark card on a light page. Every card colour came from a host variable with a hard-coded dark fallback, so the fallbacks ignored the theme the card had already applied to the document. Separately, the card read --color-success-text, --color-danger-text and --color-warning-text, which aren't MCP Apps style variable names (the spec has --color-text-success and friends), so hosts never filled them and the +N -M stats fell back to pale green and red even on light backgrounds.

The fix declares defaults once on :root with light-dark(), which follows the effective color-scheme that applyDocumentTheme pins to the host theme. Host variables are still set inline on the root, so they win whenever present. The per-use hard-coded fallbacks are removed, and the status colours now use the spec names. The diff viewer's --diffs-* backgrounds were built from the same fallbacks, so they follow along with no further change. Minor side effect: the three slightly different dark greys and text greys used as fallbacks are now one value each, so a bare dark host differs by a few shades.

Checked with the replay QA harness (codex-edit-review, #404) against origin/main and this branch, in a themed host and a bare host (theme only, no variables), light and dark. The bare light host is the bug.

Bare light host, before / after

before after

Bare light host, expanded diff, before / after

before after

Themed light host (diff stat colours), before / after

before after

Themed dark host, before / after

before after

Bare dark host, before / after

before after

Expanded diffs after the change, themed host: light, dark.

pnpm typecheck, pnpm test and pnpm build pass locally. Only the local MCP Apps host was used, not ChatGPT or Claude. The Smoke check fails on every PR because of the koffi release issue fixed by #403.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Added default light and dark theme colors when host applications don’t provide them, improving color consistency across workspace components, status indicators, review badges, and diff backgrounds.

Default the card's colour variables with light-dark() so they track the
effective color-scheme, and read the spec's --color-text-{success,danger,warning}
names instead of non-spec ones.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 56c73a19-16ca-4660-867a-e70e3e8e93f0
Commits

Reviewing files that changed from the base of the PR and between 531d3f9 and c208a99.

Files selected for processing: 1
  • src/ui/workspace-app.css

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 2 remain after this review.

Walkthrough

The stylesheet adds light and dark defaults for theme variables and updates workspace, instruction, and review colors to use shared variables without hard-coded fallbacks.

Changes: Shared Theme Colors

Layer / File(s) Summary
Theme defaults and shared component colors
src/ui/workspace-app.css
The root defines light and dark theme defaults. Shared component colors and common controls use theme variables without hard-coded fallbacks.
Workspace and instruction colors
src/ui/workspace-app.css
Workspace and instruction colors, statuses, and previews use shared theme variables without hard-coded fallbacks.
Review and diff colors
src/ui/workspace-app.css
Review labels, file-kind badges, paths, statuses, and diff backgrounds use shared theme variables without hard-coded fallbacks.

Priority: Low

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

Change: Bug fix

Possibly related PRs

  • Waishnav/devspace#404: Adds replay QA for MCP cards and reports the host-variable and dark-card issues addressed by this stylesheet update.
Merge Risk: Minimal · up to c208a

The theme fallback changes are mergeable with no remaining actionable risk.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: the UI follows the host theme when style variables are missing.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

Finishing Touches: 💡 1
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checks the colors in the light,
Then tests the dark theme through the night.
Shared tokens guide each shade in place,
No fallback hues remain to chase.
The workspace glows; the diffs look right!

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

@Waishnav
Waishnav merged commit 218eb8e into main Oct 26, 2026
2 of 4 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.

1 participant