fix(web): match the iOS status bar to the theme picked in the app
The theme-color metas used prefers-color-scheme media queries, so they followed the OS theme and ignored the in-app choice. Use a single meta that the pre-paint script and ThemeProvider update. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,8 +8,9 @@
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, viewport-fit=cover"
|
||||
/>
|
||||
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#f9f8f5" />
|
||||
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#0f1411" />
|
||||
<!-- Set from the resolved theme (script below and `theme-provider.tsx`), not with
|
||||
`media` queries: those follow the OS and ignore the theme picked in the app. -->
|
||||
<meta name="theme-color" content="#f9f8f5" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
|
||||
@@ -28,6 +29,9 @@
|
||||
stored === 'dark' || (stored !== 'light' && matchMedia('(prefers-color-scheme: dark)').matches)
|
||||
document.documentElement.classList.toggle('dark', dark)
|
||||
document.documentElement.style.colorScheme = dark ? 'dark' : 'light'
|
||||
document
|
||||
.querySelector('meta[name="theme-color"]')
|
||||
.setAttribute('content', dark ? '#0f1411' : '#f9f8f5')
|
||||
})()
|
||||
</script>
|
||||
</head>
|
||||
|
||||
Reference in New Issue
Block a user