From 3bd844edf1777a680115f88a68474b4fb434092f Mon Sep 17 00:00:00 2001 From: ethernet Date: Sun, 9 Aug 2026 19:21:32 -0400 Subject: [PATCH] fix(desktop): make un-highlighted code readable while streaming in light theme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit streaming code blocks in the light theme render near-white text on the white code card until shiki's highlight lands, then snap to normal token colors. the pale text is @tailwindcss/typography's pre foreground: its prose theme styles pre as a dark slab (--tw-prose-pre-code = gray-200 on a gray-800 bg). we strip the bg for our own code card but the near-white foreground survives on the container. shiki's opaque per-token span colors normally hide it — it shows through wherever text renders without spans: the streaming delay window, the lazy-chunk suspense fallback, and over-budget blocks that never highlight. traced on the live renderer: computed color on the wrapper of mid-stream code was oklch(0.928 0.006 264.531) (gray-200), supplied by the .prose :where(pre) rule. fix: prose-pre:text-foreground on the markdown container, so every fenced path inherits the transcript foreground instead. the utility layer is emitted after typography's base rule in the built css, so the override wins by order at equal specificity. --- apps/desktop/src/components/assistant-ui/markdown-text.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/desktop/src/components/assistant-ui/markdown-text.tsx b/apps/desktop/src/components/assistant-ui/markdown-text.tsx index c243b2d2d1693..e6245d8584244 100644 --- a/apps/desktop/src/components/assistant-ui/markdown-text.tsx +++ b/apps/desktop/src/components/assistant-ui/markdown-text.tsx @@ -422,6 +422,12 @@ const MARKDOWN_CONTAINER_CLASS_NAME = cn( 'aui-md prose w-full max-w-none overflow-hidden text-[length:var(--conversation-text-font-size)] leading-(--dt-line-height) text-foreground', 'prose-p:leading-(--dt-line-height) prose-li:leading-(--dt-line-height)', 'prose-headings:text-foreground prose-strong:text-foreground', + // Typography styles `pre` as a dark slab: light text (`--tw-prose-pre-code`, + // gray-200) on a dark bg. We strip its bg for our own light code card but its + // near-white foreground survives — invisible under Shiki's opaque token + // spans, but it's what un-highlighted text inherits (streaming delay, + // Suspense fallback, budget-exceeded blocks): unreadable in light mode. + 'prose-pre:text-foreground', 'prose-a:break-words prose-p:[overflow-wrap:anywhere]', 'prose-li:marker:text-muted-foreground/70', 'prose-code:rounded-[0.25rem] prose-code:px-[0.1875rem] prose-code:py-px prose-code:font-mono prose-code:text-[0.9em] prose-code:font-normal prose-code:before:content-none prose-code:after:content-none',