[Bug]: HTML files opened in the file viewer get none of the app theme, so they clash with the chat
Before submitting
- [x] I searched existing issues and did not find a duplicate.
- [x] I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
- Pick a custom theme (dark, with non-default canvas and text colors).
- In a thread, have the assistant write a small
page.htmlthat styles itself with the documented theme variables, e.g.body{background:var(--background);color:var(--foreground)}, plus a line of plain unstyled text. - Click the file link in the reply, so it opens in the right-side file viewer.
- Compare with the same HTML sent through
html_renderin 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:274rendersBrowserDocumentFramewithouthtmlRender, so a workspace.htmlgoes toFileDocument(BrowserDocumentFrame.tsx:165-174): a plain sandboxed iframe withbg-white, no theme fragment, nohtmlRenderThemeMessage, nocolor-scheme.- The server serves the file raw (
apps/server/src/http.tsassetFileResponse); onlyrenderIntent: "mcp-app"getsinjectMcpAppThemeBootstrap. html_renderframes instead get the active palette fromuseHtmlRenderTheme->htmlRenderTheme(packages/shared/src/htmlRender.ts:175) viaHtmlRenderDocument(BrowserDocumentFrame.tsx:187-196), the same colorsapplyThemePalette(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.