From 49fca1074fc9af90adc8d9eb98f42119f40b0062 Mon Sep 17 00:00:00 2001 From: cannuri <91494156+cannuri@users.noreply.github.com> Date: Wed, 12 Mar 2025 02:32:59 +0100 Subject: [PATCH] Fix MarkdownBlock text color for Dark High Contrast theme --- webview-ui/src/components/common/MarkdownBlock.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/webview-ui/src/components/common/MarkdownBlock.tsx b/webview-ui/src/components/common/MarkdownBlock.tsx index 2af86e8dbc1..bedd291d67c 100644 --- a/webview-ui/src/components/common/MarkdownBlock.tsx +++ b/webview-ui/src/components/common/MarkdownBlock.tsx @@ -63,9 +63,9 @@ const StyledMarkdown = styled.div` white-space: pre-wrap; } - :where(h1, h2, h3, h4, h5, h6):has(code) code { - font-size: inherit; - } + :where(h1, h2, h3, h4, h5, h6):has(code) code { + font-size: inherit; + } pre > code { .hljs-deletion { @@ -103,6 +103,14 @@ const StyledMarkdown = styled.div` overflow-wrap: anywhere; } + /* Target only Dark High Contrast theme using the data attribute VS Code adds to the body */ + body[data-vscode-theme-kind="vscode-high-contrast"] & code:not(pre > code) { + color: var( + --vscode-editorInlayHint-foreground, + var(--vscode-symbolIcon-stringForeground, var(--vscode-charts-orange, #e9a700)) + ); + } + font-family: var(--vscode-font-family), system-ui,