refac: theme

This commit is contained in:
Timothy Jaeryang Baek 2025-02-15 21:04:07 -08:00
parent 87ff1a9038
commit e4d6fc65ca
2 changed files with 14 additions and 5 deletions

View File

@ -141,12 +141,10 @@
} }
} }
console.log(_theme); if (typeof window !== 'undefined' && window.applyTheme) {
}; window.applyTheme();
}
const themeChangeHandler = (_theme: string) => {
theme.set(_theme);
localStorage.setItem('theme', _theme);
if (_theme.includes('oled')) { if (_theme.includes('oled')) {
document.documentElement.style.setProperty('--color-gray-800', '#101010'); document.documentElement.style.setProperty('--color-gray-800', '#101010');
document.documentElement.style.setProperty('--color-gray-850', '#050505'); document.documentElement.style.setProperty('--color-gray-850', '#050505');
@ -154,6 +152,13 @@
document.documentElement.style.setProperty('--color-gray-950', '#000000'); document.documentElement.style.setProperty('--color-gray-950', '#000000');
document.documentElement.classList.add('dark'); document.documentElement.classList.add('dark');
} }
console.log(_theme);
};
const themeChangeHandler = (_theme: string) => {
theme.set(_theme);
localStorage.setItem('theme', _theme);
applyTheme(_theme); applyTheme(_theme);
}; };
</script> </script>

View File

@ -396,6 +396,10 @@
}; };
onMount(async () => { onMount(async () => {
if (typeof window !== 'undefined' && window.applyTheme) {
window.applyTheme();
}
if (window?.electronAPI) { if (window?.electronAPI) {
const info = await window.electronAPI.send({ const info = await window.electronAPI.send({
type: 'app:info' type: 'app:info'