main #2

Merged
tdpeuter merged 129 commits from open-webui/open-webui:main into main 2024-03-20 21:29:12 +01:00
Showing only changes of commit f1716f45b9 - Show all commits

View file

@ -13,13 +13,29 @@
(!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: light)').matches) (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: light)').matches)
) { ) {
document.documentElement.classList.add('light'); document.documentElement.classList.add('light');
} else if (localStorage.theme) { } else if (localStorage.theme && localStorage.theme !== 'system') {
localStorage.theme.split(' ').forEach((e) => { localStorage.theme.split(' ').forEach((e) => {
document.documentElement.classList.add(e); document.documentElement.classList.add(e);
}); });
} else { } else if (localStorage.theme && localStorage.theme === 'system') {
systemTheme = window.matchMedia('(prefers-color-scheme: dark)').matches;
document.documentElement.classList.add(systemTheme ? 'dark' : 'light');
}
else {
document.documentElement.classList.add('dark'); document.documentElement.classList.add('dark');
} }
window.matchMedia('(prefers-color-scheme: dark)').addListener((e) => {
if (localStorage.theme === 'system') {
if (e.matches) {
document.documentElement.classList.add('dark');
document.documentElement.classList.remove('light');
} else {
document.documentElement.classList.add('light');
document.documentElement.classList.remove('dark');
}
}
});
</script> </script>
%sveltekit.head% %sveltekit.head%