File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 714714 await goto(` / ? q= ${encodeURIComponent (event .data .query )}` );
715715 return;
716716 }
717+ if (event.type === 'theme:update' && event.data?.theme) {
718+ const newTheme = event.data.theme;
719+ localStorage.setItem('theme', newTheme);
720+ theme.set(newTheme);
721+
722+ // Apply theme classes (mirrors logic from chat/Settings/General.svelte)
723+ const themes = ['dark', 'light', 'oled-dark'];
724+ let themeToApply = newTheme === 'oled-dark' ? 'dark' : newTheme === 'her' ? 'light' : newTheme;
725+ if (newTheme === 'system') {
726+ themeToApply = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
727+ }
728+ themes
729+ .filter((e) => e !== themeToApply)
730+ .forEach((e) => {
731+ e.split(' ').forEach((cls) => document.documentElement.classList.remove(cls));
732+ });
733+ themeToApply.split(' ').forEach((cls) => document.documentElement.classList.add(cls));
734+ return;
735+ }
717736 if (event.type === 'models:refresh') {
718737 const token = localStorage.token;
719738 if (token) {
You can’t perform that action at this time.
0 commit comments