12 lines
542 B
JavaScript
12 lines
542 B
JavaScript
// Runs synchronously in <head>, before React/styles paint. Dark is the default.
|
|
(function () {
|
|
var theme = 'dark';
|
|
try {
|
|
if (window.localStorage.getItem('bortstack-theme') === 'light') theme = 'light';
|
|
} catch { /* Storage is optional; rendering and the toggle remain available. */ }
|
|
document.documentElement.dataset.bsTheme = theme;
|
|
document.documentElement.style.colorScheme = theme;
|
|
var meta = document.querySelector('meta[name="theme-color"]');
|
|
if (meta) meta.content = theme === 'light' ? '#F5F7FA' : '#0E1117';
|
|
}());
|