Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(chat): keep highlighted code on its code block's background in dark mode (#691)

Ruben Lütkec927486f2211
diff --git a/jarvis/ui/web/frontend/src/components/docs/CodeBlock.tsx b/jarvis/ui/web/frontend/src/components/docs/CodeBlock.tsx
index d7bbaf4d2a..b192bc07b9 100644
--- a/jarvis/ui/web/frontend/src/components/docs/CodeBlock.tsx
+++ b/jarvis/ui/web/frontend/src/components/docs/CodeBlock.tsx
@@ -185,7 +185,7 @@ export function CodeBlock({ language, code, chrome = true, dense = false }: Code
{/* Body — either Shiki HTML or plain text */}
{html ? (
<div
- className="overflow-x-auto px-4 py-3.5 font-mono text-sm leading-6 [&_pre]:m-0 [&_pre]:!bg-transparent [&_pre]:font-mono"
+ className="code-block-body overflow-x-auto px-4 py-3.5 font-mono text-sm leading-6 [&_pre]:m-0 [&_pre]:!bg-transparent [&_pre]:font-mono"
// sanitized by Shiki — our code is only rendered locally
dangerouslySetInnerHTML={{ __html: html }}
/>
diff --git a/jarvis/ui/web/frontend/src/index.css b/jarvis/ui/web/frontend/src/index.css
index b2a4f00644..d0549f9981 100644
--- a/jarvis/ui/web/frontend/src/index.css
+++ b/jarvis/ui/web/frontend/src/index.css
@@ -428,6 +428,13 @@ label,
font-weight: var(--shiki-dark-font-weight) !important;
text-decoration: var(--shiki-dark-text-decoration) !important;
}
+/* Inside the app's code block the frame is the background. The dark theme's
+ own ground (github-dark's near-black) would otherwise paint a second, darker
+ box behind every line inside the card. */
+.dark .code-block-body .shiki,
+.dark .code-block-body .shiki span {
+ background-color: transparent !important;
+}
/* xterm.js viewport scrollbar — PLAIN (non-@layer) CSS on purpose. Tailwind
tree-shakes `@layer utilities` by class usage, and `.xterm-viewport` is