Make the status bar follow a theme pinned in Settings

This commit is contained in:
iamdoubz committed 2026-11-05 22:05:32 -06:00
1 parent 9aa87ad544
commit 4141a413aa
1 file changed
+8
+8
View File
@@ -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());