26 lines
961 B
JavaScript
26 lines
961 B
JavaScript
/* Set Mike AI's global Open WebUI theme before the Svelte app mounts. */
|
|
(() => {
|
|
try {
|
|
/* The upstream static route is aggressively cached by browsers. Give the
|
|
* mounted theme its own versioned URL so theme releases update reliably. */
|
|
const themeStylesheet = document.querySelector('link[href^="/static/custom.css"]');
|
|
if (themeStylesheet) {
|
|
themeStylesheet.setAttribute(
|
|
'href',
|
|
'/static/custom.css?theme=native-background-v4'
|
|
);
|
|
}
|
|
|
|
localStorage.setItem('theme', 'dark');
|
|
document.documentElement.classList.remove('light', 'her');
|
|
document.documentElement.classList.add('dark');
|
|
document.documentElement.style.colorScheme = 'dark';
|
|
|
|
const themeColor = document.querySelector('meta[name="theme-color"]');
|
|
if (themeColor) themeColor.setAttribute('content', '#070a12');
|
|
} catch (_) {
|
|
/* Storage can be unavailable in locked-down/private browser contexts. */
|
|
document.documentElement.classList.add('dark');
|
|
}
|
|
})();
|