fix: typescript issue

This commit is contained in:
Xyphyn committed 2023-09-14 19:22:11 -07:00
1 parent b500bc8221
commit dce4e4e751
2 files changed
+22 -5

No files matched your search

+17 -2
View File
@@ -8,9 +8,11 @@
import Sidebar from '$lib/components/ui/sidebar/Sidebar.svelte'
// @ts-ignore
import { pwaInfo } from 'virtual:pwa-info'
import { inDarkTheme } from '$lib/ui/colors.js'
import { inDarkTheme, theme } from '$lib/ui/colors.js'
import { userSettings } from '$lib/settings.js'
import { ToastContainer } from 'mono-svelte'
import { onMount } from 'svelte'
import { browser } from '$app/environment'
nProgress.configure({
minimum: 0.4,
@@ -34,10 +36,23 @@
}
$: webManifest = pwaInfo ? pwaInfo.webManifest.linkTag : ''
$: darkTheme = $theme && inDarkTheme()
$: console.log(darkTheme)
onMount(() => {
if (browser) {
window
.matchMedia('(prefers-color-scheme: dark)')
.addEventListener('change', (event) => {
darkTheme = inDarkTheme()
})
}
})
</script>
<svelte:head>
<meta name="theme-color" content={inDarkTheme() ? '#020202' : '#f6f9fb'} />
<meta name="theme-color" content={darkTheme ? '#020202' : '#f6f9fb'} />
{@html webManifest}
</svelte:head>