Skip to content

[Bug]: HTML files opened in the file viewer get none of the app theme, so they clash with the chat #32485

Closed

Description

@baohappy02

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Pick a custom theme (dark, with non-default canvas and text colors).
  2. In a thread, have the assistant write a small page.html that styles itself with the documented theme variables, e.g. body{background:var(--background);color:var(--foreground)}, plus a line of plain unstyled text.
  3. Click the file link in the reply, so it opens in the right-side file viewer.
  4. Compare with the same HTML sent through html_render in the chat.

Expected behavior

The file viewer's HTML frame gets the same theme as the chat (the --background, --foreground, ... variables, color-scheme and font stacks that html_render frames get), or at least the active theme's canvas and text colors, so the page matches the chat and sidebar.

Actual behavior

The page uses a different color set than the chat; with a custom theme its text looks harsh and does not match. The html_render copy of the same HTML matches the theme.

Cause in source (tag v0.1.8-nightly.20261106.4288, unchanged on main):

  • FilePreviewPanel.tsx:274 renders BrowserDocumentFrame without htmlRender, so a workspace .html goes to FileDocument (BrowserDocumentFrame.tsx:165-174): a plain sandboxed iframe with bg-white, no theme fragment, no htmlRenderThemeMessage, no color-scheme.
  • The server serves the file raw (apps/server/src/http.ts assetFileResponse); only renderIntent: "mcp-app" gets injectMcpAppThemeBootstrap.
  • html_render frames instead get the active palette from useHtmlRenderTheme -> htmlRenderTheme (packages/shared/src/htmlRender.ts:175) via HtmlRenderDocument (BrowserDocumentFrame.tsx:187-196), the same colors applyThemePalette (themePalette.ts:1618) sets for the chat.

Suggested fix: have FileDocument pass the same theme (fragment + htmlRenderThemeMessage, colorScheme style) to HTML files, or inject the theme bootstrap the way MCP apps get it, so pages that use the theme variables match the app.

Impact

Major degradation or frequent failure

Version or commit

v0.1.8-nightly.20261106.4288

Environment

macOS, T3 Code (Nightly) desktop app

Logs or stack traces

Screenshots, recordings, or supporting files

No response

Workaround

Send the page with html_render instead of opening the file, or hardcode the colors in the file.

Activity

  1. added
    bugSomething is broken or behaving incorrectly.
    needs-triageIssue needs maintainer review and initial categorization.
    on Nov 7, 2026
  2. locked and limited conversation to collaborators on Nov 7, 2026
  3. converted this issue into a discussion #32486 on Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken or behaving incorrectly.needs-triageIssue needs maintainer review and initial categorization.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions