We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9b38001 commit 72810ddCopy full SHA for 72810dd
src/components/theme-switch.tsx
@@ -1,9 +1,19 @@
1
import { IconMoon, IconSun } from '@tabler/icons-react'
2
import { useTheme } from './theme-provider'
3
import { Button } from './custom/button'
4
+import { useEffect } from 'react'
5
6
export default function ThemeSwitch() {
7
const { theme, setTheme } = useTheme()
8
+
9
+ /* Update theme-color meta tag
10
+ * when theme is updated */
11
+ useEffect(() => {
12
+ const themeColor = theme === 'dark' ? '#020817' : '#fff'
13
+ const metaThemeColor = document.querySelector("meta[name='theme-color']")
14
+ metaThemeColor && metaThemeColor.setAttribute('content', themeColor)
15
+ }, [theme])
16
17
return (
18
<Button
19
size='icon'
0 commit comments