mirror of
https://github.com/db9979/wibosim.git
synced 2026-12-06 05:24:08 +01:00
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018i4GUhQVoPUusUzxgxLWkK
13 lines
960 B
JavaScript
13 lines
960 B
JavaScript
// Farbschema so früh wie möglich setzen (vor dem ersten Rendern), damit kein falsches Schema aufblitzt.
|
|
// Klassisches Skript (kein Modul, kein defer): wird im <head> synchron geladen. Logik: js/theme.js.
|
|
(function () {
|
|
var pref = 'boerse'; // Standard ohne eigene Wahl (wie DEFAULT_THEME in js/theme.js)
|
|
try { var v = JSON.parse(localStorage.getItem('wibo.theme')); if (v === 'light' || v === 'dark' || v === 'boerse' || v === 'system') pref = v; } catch (e) { /* egal */ }
|
|
var light = pref === 'light' || (pref === 'system' && !!window.matchMedia && matchMedia('(prefers-color-scheme: light)').matches);
|
|
var root = document.documentElement;
|
|
root.setAttribute('data-theme', light ? 'light' : 'dark');
|
|
if (pref === 'boerse') root.setAttribute('data-look', 'boerse');
|
|
var meta = document.querySelector('meta[name="theme-color"]');
|
|
if (meta) meta.setAttribute('content', light ? '#f2f4f8' : pref === 'boerse' ? '#070b13' : '#0b0f17');
|
|
})();
|