Make the status bar follow a theme pinned in Settings
This commit is contained in:
1 parent
9aa87ad544
commit
4141a413aa
1 file changed
+8
@@ -52,4 +52,12 @@ export function setTheme(t: Theme) {
|
||||
} catch {}
|
||||
if (t === 'system') delete document.documentElement.dataset.theme;
|
||||
else document.documentElement.dataset.theme = t;
|
||||
syncThemeColor(t);
|
||||
}
|
||||
// The status bar and browser chrome follow a theme pinned in Settings, not only the device's mode.
|
||||
function syncThemeColor(t: Theme) {
|
||||
document.querySelectorAll<HTMLMetaElement>('meta[name="theme-color"]').forEach((m) => {
|
||||
m.media = t === 'system' ? `(prefers-color-scheme: ${m.dataset.for})` : t === m.dataset.for ? 'all' : 'not all';
|
||||
});
|
||||
}
|
||||
syncThemeColor(getTheme());
|
||||
Reference in new issue
Block a user