diff --git a/site/src/pages/AgentsPage/components/ChatElements/tools/utils.ts b/site/src/pages/AgentsPage/components/ChatElements/tools/utils.ts index 7db27fc1a39..d90f61d0ba1 100644 --- a/site/src/pages/AgentsPage/components/ChatElements/tools/utils.ts +++ b/site/src/pages/AgentsPage/components/ChatElements/tools/utils.ts @@ -417,17 +417,25 @@ export function getFileViewerOptionsMinimal(isDark: boolean) { export const stripSvnIndexHeaders = (patch: string): string => patch.replace(/^Index: .*\n={3,}\n/gm, ""); -export const DIFFS_FONT_STYLE = { - "--diffs-font-family": '"Geist Mono Variable", monospace, monospace', - "--diffs-header-font-family": '"Geist Variable", system-ui, sans-serif', - "--diffs-font-size": "11px", - "--diffs-line-height": "1.5", +/** + * Diff addition and deletion colors from the dashboard theme, so diffs follow + * the active theme variant, including the colorblind ones. + */ +export const DIFFS_GIT_COLOR_STYLE = { "--diffs-addition-color-override": "hsl(var(--git-added))", "--diffs-deletion-color-override": "hsl(var(--git-deleted))", "--diffs-bg-addition-override": "hsl(var(--surface-git-added))", "--diffs-bg-deletion-override": "hsl(var(--surface-git-deleted))", "--diffs-bg-addition-number-override": "hsl(var(--surface-git-added))", "--diffs-bg-deletion-number-override": "hsl(var(--surface-git-deleted))", +}; + +export const DIFFS_FONT_STYLE = { + "--diffs-font-family": '"Geist Mono Variable", monospace, monospace', + "--diffs-header-font-family": '"Geist Variable", system-ui, sans-serif', + "--diffs-font-size": "11px", + "--diffs-line-height": "1.5", + ...DIFFS_GIT_COLOR_STYLE, "--diffs-bg-selection-override": "hsl(var(--content-link) / 0.08)", "--diffs-bg-selection-number-override": "hsl(var(--content-link) / 0.13)", "--diffs-selection-number-fg": "hsl(var(--content-link))", diff --git a/site/src/pages/AgentsPage/components/DiffViewer/DiffViewer.tsx b/site/src/pages/AgentsPage/components/DiffViewer/DiffViewer.tsx index 4e8b7f47dc4..e27d511ebaa 100644 --- a/site/src/pages/AgentsPage/components/DiffViewer/DiffViewer.tsx +++ b/site/src/pages/AgentsPage/components/DiffViewer/DiffViewer.tsx @@ -16,7 +16,10 @@ import { Skeleton } from "#/components/Skeleton/Skeleton"; import { useTheme } from "#/theme/context"; import { countChangedLines } from "../../utils/countChangedLines"; import { changeColor, changeLabel } from "../../utils/diffColors"; -import { SEPARATOR_CSS } from "../ChatElements/tools/utils"; +import { + DIFFS_GIT_COLOR_STYLE, + SEPARATOR_CSS, +} from "../ChatElements/tools/utils"; import { useActiveFileTracking } from "./useActiveFileTracking"; type DiffViewerProps = { @@ -65,6 +68,7 @@ const diffViewerStyle = { "--diffs-header-font-family": '"Geist Variable", system-ui, sans-serif', "--diffs-font-size": "11px", "--diffs-line-height": `${DIFF_VIEWER_LINE_HEIGHT}px`, + ...DIFFS_GIT_COLOR_STYLE, } satisfies React.CSSProperties; const diffViewerMetrics: Partial = {