Skip to content

Commit 3f8b742

Browse files
committed
fix: set body class when appearance changes. (#653)
1 parent 8976546 commit 3f8b742

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

refact-agent/gui/src/app/middleware.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {
2828
setError,
2929
setIsAuthError,
3030
} from "../features/Errors/errorsSlice";
31-
import { updateConfig } from "../features/Config/configSlice";
31+
import { setThemeMode, updateConfig } from "../features/Config/configSlice";
3232
import { resetAttachedImagesSlice } from "../features/AttachedImages";
3333
import { nextTip } from "../features/TipOfTheDay";
3434
import { telemetryApi } from "../services/refact/telemetry";
@@ -521,3 +521,18 @@ startListening({
521521
}
522522
},
523523
});
524+
525+
startListening({
526+
matcher: isAnyOf(updateConfig.match, setThemeMode.match),
527+
effect: (_action, listenerApi) => {
528+
const appearance = listenerApi.getState().config.themeProps.appearance;
529+
if (appearance === "light" && document.body.className !== "vscode-light") {
530+
document.body.className = "vscode-light";
531+
} else if (
532+
appearance === "dark" &&
533+
document.body.className !== "vscode-dark"
534+
) {
535+
document.body.className = "vscode-dark";
536+
}
537+
},
538+
});

0 commit comments

Comments
 (0)