fix(editor): keep an editor color scheme chosen together with the theme (#1138)

Since #1100 a theme that turns light or dark switches a chosen scheme of the other kind back to the theme's own. It did so also when the scheme was chosen in the same Apply as the theme, so One Light + Solarized Dark left the default light editor. A scheme set by the settings change that also changes the theme now goes with it; a later theme change on its own still switches it back.

Closes #1136

Co-authored-by: fhrmrk <[email protected]>
This commit is contained in:
Park Jong Hyun authored and GitHub committed 2026-11-04 10:07:04 +08:00
1 parent 2ec2b76d7a
commit 280c2da48f
2 files changed
+28 -2

No files matched your search

+13
View File
@@ -92,6 +92,19 @@ describe("color schemes", () => {
root.dataset.theme = "dark";
await Promise.resolve();
expect(scheme()).toBe("dark");
// A scheme chosen in the same change as the theme (one Apply) goes with it.
await new Promise((r) => setTimeout(r));
useProject.setState({ settings: { editor: { colorScheme: "solarized-dark" } } as unknown as Settings });
root.dataset.theme = "light";
await Promise.resolve();
expect(scheme()).toBe("solarized-dark");
// A later theme change on its own still switches it back.
await new Promise((r) => setTimeout(r));
root.dataset.theme = "dark";
await Promise.resolve();
root.dataset.theme = "light";
await Promise.resolve();
expect(scheme()).toBe("theme-default");
} finally {
dispose();
delete root.dataset.colorTheme;