From f383b0ec7185b50768a2ec28d56e0f55150d3e53 Mon Sep 17 00:00:00 2001 From: JOJO <1498581755@qq.com> Date: Sun, 7 Jun 2026 02:57:58 +0800 Subject: [PATCH] fix(ui): refine dark code block styling Remove stray borders, outlines, shadows, and token backgrounds from markdown code content in dark mode to avoid the visible white frame around code text. Adjust code block body padding so code content sits closer to the block edge while staying visually aligned with the language label. --- .../src/styles/components/chat/_chat-area.scss | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/static/src/styles/components/chat/_chat-area.scss b/static/src/styles/components/chat/_chat-area.scss index 872fa93..0e4d328 100644 --- a/static/src/styles/components/chat/_chat-area.scss +++ b/static/src/styles/components/chat/_chat-area.scss @@ -1429,7 +1429,7 @@ show-html:not([data-rendered='1'])[ratio='3:4'] { .code-block-wrapper pre { background: var(--theme-surface-strong) !important; - padding: 24px 28px 28px !important; + padding: 18px 20px 22px !important; margin: 0 !important; border-radius: 0 !important; border: none !important; @@ -1451,6 +1451,8 @@ show-html:not([data-rendered='1'])[ratio='3:4'] { .code-block-wrapper pre code { background: transparent !important; padding: 0 !important; + border: 0 !important; + box-shadow: none !important; color: var(--claude-text); font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', 'Menlo', 'Monaco', 'Courier New', @@ -1464,6 +1466,20 @@ show-html:not([data-rendered='1'])[ratio='3:4'] { animation: none !important; /* 避免被其他动画样式污染导致行距抖动 */ } +:root[data-theme='dark'] .code-block-wrapper pre, +:root[data-theme='dark'] .code-block-wrapper pre code, +:root[data-theme='dark'] .code-block-wrapper pre code span { + background: transparent !important; + border: 0 !important; + box-shadow: none !important; + outline: 0 !important; + text-shadow: none !important; +} + +:root[data-theme='dark'] .code-block-wrapper pre { + background: var(--theme-surface-strong) !important; +} + .streaming-text { display: block; }