From 01e5e44be060d86e677dc30ebd4b185ae6a30a6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=91=9E?= <2896402717@qq.com> Date: Tue, 30 Dec 2025 21:46:58 +0800 Subject: [PATCH] Fixed code highlighting issues in dark mode --- apps/docs/app/global.css | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/apps/docs/app/global.css b/apps/docs/app/global.css index 619281ea..8d5a4842 100644 --- a/apps/docs/app/global.css +++ b/apps/docs/app/global.css @@ -136,4 +136,18 @@ #nd-sidebar { @apply mt-[146px]!; } :root { --fd-layout-width: 1308px; --fd-page-width: 100%; } #nd-page > article { @apply pt-[76px]!; } -#nd-tocnav { @apply top-[53px]!; } \ No newline at end of file +#nd-tocnav { @apply top-[53px]!; } + +@layer base { + /* 当处于暗色模式时,强制覆盖 Shiki 的行内 color */ + .dark pre[style*="--shiki-dark"], + .dark code[style*="--shiki-dark"] { + color: var(--shiki-dark) !important; + background-color: #0d1117 !important; + } + + /* 针对 span 级别的语法高亮颜色 */ + .dark span[style*="--shiki-dark"] { + color: var(--shiki-dark) !important; + } +} \ No newline at end of file