Skip to content

The agent that grows with you

fix(desktop): paint diffs from the theme palette

Brooklyn Nicholson93477b2a0c26
diff --git a/apps/desktop/src/components/chat/diff-lines.tsx b/apps/desktop/src/components/chat/diff-lines.tsx
index edcf08e38f7..d7155bef288 100644
--- a/apps/desktop/src/components/chat/diff-lines.tsx
+++ b/apps/desktop/src/components/chat/diff-lines.tsx
@@ -41,15 +41,15 @@ interface ParsedHunk {
// plain renderer; the Shiki path omits it so syntax colors win, layering only
// the background + border.
const DIFF_KIND_TINT: Record<DiffKind, string> = {
- add: 'border-emerald-500 bg-emerald-500/12',
+ add: 'border-(--ui-diff-add-border) bg-(--ui-diff-add-background)',
context: 'border-transparent',
- remove: 'border-rose-500 bg-rose-500/12'
+ remove: 'border-(--ui-diff-remove-border) bg-(--ui-diff-remove-background)'
}
const DIFF_KIND_TEXT: Record<DiffKind, string> = {
- add: 'text-emerald-800 dark:text-emerald-200',
+ add: 'text-(--ui-diff-add-foreground)',
context: '',
- remove: 'text-rose-800 dark:text-rose-200'
+ remove: 'text-(--ui-diff-remove-foreground)'
}
const DIFF_LINE_BASE = 'block min-w-max whitespace-pre border-l-2 px-2.5 py-px'
@@ -537,7 +537,10 @@ function DiffOverviewRuler({ lines }: { lines: DiffLine[] }) {
<div className="relative w-full" style={{ height: `min(100%, ${lines.length * PREVIEW_LINE_PX}px)` }}>
{runs.map((run, index) => (
<div
- className={cn('absolute inset-x-0', run.kind === 'add' ? 'bg-(--ui-green)' : 'bg-(--ui-red)')}
+ className={cn(
+ 'absolute inset-x-0',
+ run.kind === 'add' ? 'bg-(--ui-diff-add-border)' : 'bg-(--ui-diff-remove-border)'
+ )}
key={index}
style={{ height: `max(0.125rem, ${run.sizePct}%)`, top: `${run.startPct}%` }}
/>
diff --git a/apps/desktop/src/styles.css b/apps/desktop/src/styles.css
index 0f7fdbdd3b4..5d34dbfb749 100644
--- a/apps/desktop/src/styles.css
+++ b/apps/desktop/src/styles.css
@@ -188,6 +188,16 @@
--context-usage-subagents: color-mix(in srgb, var(--ui-blue) 70%, var(--ui-cyan));
--context-usage-memory: color-mix(in srgb, var(--ui-orange) 80%, var(--ui-yellow));
--context-usage-conversation: var(--ui-cyan);
+ /* Diff add/remove, derived from the semantic palette so every diff surface
+ (tool cards, preview, review pane) tracks the theme's green/red. Only the
+ foregrounds need a dark override — they mix toward the page instead of
+ away from it. */
+ --ui-diff-add-border: var(--ui-green);
+ --ui-diff-add-background: color-mix(in srgb, var(--ui-green) 12%, transparent);
+ --ui-diff-add-foreground: color-mix(in srgb, var(--ui-green) 70%, #000);
+ --ui-diff-remove-border: var(--ui-red);
+ --ui-diff-remove-background: color-mix(in srgb, var(--ui-red) 12%, transparent);
+ --ui-diff-remove-foreground: color-mix(in srgb, var(--ui-red) 70%, #000);
--ui-bg-chrome: color-mix(
in srgb,
var(--theme-background-seed) var(--theme-mix-chrome),
@@ -444,6 +454,8 @@
--ui-red: #e75e78;
--ui-green: #55a583;
--ui-cyan: #6f9ba6;
+ --ui-diff-add-foreground: color-mix(in srgb, var(--ui-green) 62%, #fff);
+ --ui-diff-remove-foreground: color-mix(in srgb, var(--ui-red) 62%, #fff);
--sidebar-edge-border: color-mix(in srgb, var(--ui-base) 12%, transparent);
--composer-ring-strength: 1.3;