Skip to content

Commit

Permalink
fix: ios pwa dark theme set status bar color
Browse files Browse the repository at this point in the history
Signed-off-by: BobDu <i@bobdu.cc>
  • Loading branch information
BobDu committed Jan 15, 2024
1 parent 26ec966 commit 35608f4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<link rel="apple-touch-icon" href="/favicon.ico">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover" />
<meta name="theme-color">
<title>${SITE_TITLE}</title>
</head>

Expand Down
8 changes: 6 additions & 2 deletions src/hooks/useTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ export function useTheme() {
watch(
() => isDark.value,
(dark) => {
if (dark)
if (dark) {
document.documentElement.classList.add('dark')
else
document.querySelector('head meta[name="theme-color"]')?.setAttribute('content', '#121212')
}
else {
document.documentElement.classList.remove('dark')
document.querySelector('head meta[name="theme-color"]')?.setAttribute('content', '#eee')
}
},
{ immediate: true },
)
Expand Down

0 comments on commit 35608f4

Please sign in to comment.