From 90a3f618f3e5c56d4484b0261c47c908e4094993 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Sat, 1 Mar 2025 18:20:35 -0800 Subject: [PATCH] fix(code): fix styling for dark mode code block --- .../components/sub-block/components/code.tsx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/w/[id]/components/workflow-block/components/sub-block/components/code.tsx b/app/w/[id]/components/workflow-block/components/sub-block/components/code.tsx index dd0446d831..7505c0a43d 100644 --- a/app/w/[id]/components/workflow-block/components/sub-block/components/code.tsx +++ b/app/w/[id]/components/workflow-block/components/sub-block/components/code.tsx @@ -17,6 +17,24 @@ interface CodeProps { placeholder?: string } +if (typeof document !== 'undefined') { + const styleId = 'code-dark-mode-fix' + if (!document.getElementById(styleId)) { + const style = document.createElement('style') + style.id = styleId + style.textContent = ` + .dark .token.operator { + color: #9cdcfe !important; + background: transparent !important; + } + .dark .token.punctuation { + color: #d4d4d4 !important; + } + ` + document.head.appendChild(style) + } +} + export function Code({ blockId, subBlockId,