diff --git a/apps/web/src/components/chat/TimelineUserMessageRow.tsx b/apps/web/src/components/chat/TimelineUserMessageRow.tsx index 67bf9c2eec902..ae55a3214da9e 100644 --- a/apps/web/src/components/chat/TimelineUserMessageRow.tsx +++ b/apps/web/src/components/chat/TimelineUserMessageRow.tsx @@ -1218,7 +1218,7 @@ const UserMessageBody = memo(function UserMessageBody(props: { cwd={props.markdownCwd} threadRef={ctx.threadRef ?? undefined} skills={props.skills} - className="text-foreground user-message-markdown" + className="text-message-foreground user-message-markdown" lineBreaks parseRawHtml={false} extraRemarkPlugins={USER_MESSAGE_REMARK_PLUGINS} diff --git a/apps/web/src/index.css b/apps/web/src/index.css index 654ef108e8e75..676e120e826de 100644 --- a/apps/web/src/index.css +++ b/apps/web/src/index.css @@ -2138,6 +2138,11 @@ code { font-size: 0.85em; } +.chat-markdown.user-message-markdown :not(pre) > code { + background: color-mix(in srgb, var(--contrast-message-foreground) 10%, transparent); + color: var(--contrast-message-foreground); +} + .chat-markdown strong { font-weight: 700; } @@ -2202,6 +2207,18 @@ code { } } +/* Sent messages color prose with the message foreground, which is not chosen + for the code surface, so their plain-text fences keep the global foreground. */ +.chat-markdown.user-message-markdown + .chat-markdown-codeblock:is( + [data-language="text" i], + [data-language="txt" i], + [data-language="plain" i], + [data-language="plaintext" i] + ) { + color: var(--contrast-foreground) !important; +} + /* Paragraphs and code blocks arrive in chunks while a response streams. Fade each new block in so the chunk does not pop. @starting-style only applies when an element is first inserted, and the rule is gated on data-streaming,