This commit is contained in:
Timothy Jaeryang Baek
2026-04-07 15:04:57 -06:00
parent 8e82f0d239
commit 9f1b279e88
+19
View File
@@ -714,6 +714,25 @@
await goto(`/?q=${encodeURIComponent(event.data.query)}`);
return;
}
if (event.type === 'theme:update' && event.data?.theme) {
const newTheme = event.data.theme;
localStorage.setItem('theme', newTheme);
theme.set(newTheme);
// Apply theme classes (mirrors logic from chat/Settings/General.svelte)
const themes = ['dark', 'light', 'oled-dark'];
let themeToApply = newTheme === 'oled-dark' ? 'dark' : newTheme === 'her' ? 'light' : newTheme;
if (newTheme === 'system') {
themeToApply = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
}
themes
.filter((e) => e !== themeToApply)
.forEach((e) => {
e.split(' ').forEach((cls) => document.documentElement.classList.remove(cls));
});
themeToApply.split(' ').forEach((cls) => document.documentElement.classList.add(cls));
return;
}
if (event.type === 'models:refresh') {
const token = localStorage.token;
if (token) {