Skip to content

Commit efdf13f

Browse files
authored
fix: lock diff viewer to dark colors (#220)
1 parent 938aadc commit efdf13f

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

frontend/src/lib/DiffDialog.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
4343
const diffOpts = {
4444
outputFormat: "line-by-line" as const,
45-
colorScheme: ColorSchemeType.AUTO,
45+
colorScheme: ColorSchemeType.DARK,
4646
drawFileList: false,
4747
};
4848

frontend/src/lib/DiffDialog.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,25 @@ describe("DiffDialog", () => {
5858
"cursor://file/tmp/feature/status",
5959
);
6060
});
61+
62+
it("renders uncommitted diffs with the app's dark color scheme", async () => {
63+
vi.mocked(api.fetchWorktreeDiff).mockResolvedValue({
64+
uncommitted:
65+
"diff --git a/src/example.ts b/src/example.ts\nindex e69de29..4b825dc 100644\n--- a/src/example.ts\n+++ b/src/example.ts\n@@ -0,0 +1 @@\n+const value = 1;\n",
66+
uncommittedTruncated: false,
67+
gitStatus: "",
68+
unpushedCommits: [],
69+
});
70+
71+
const { container } = render(DiffDialog, {
72+
props: {
73+
branch: "feature/diff-colors",
74+
onclose: vi.fn(),
75+
},
76+
});
77+
78+
await screen.findByRole("button", { name: "Current diff" });
79+
80+
expect(container.querySelector(".d2h-wrapper")).toHaveClass("d2h-dark-color-scheme");
81+
});
6182
});

0 commit comments

Comments
 (0)