Light- und Darkmode hinzugefügt
Some checks failed
Host-Based Deploy (Java 21 Fix) / build-and-run (push) Has been cancelled
Some checks failed
Host-Based Deploy (Java 21 Fix) / build-and-run (push) Has been cancelled
This commit is contained in:
@@ -1,4 +1,23 @@
|
||||
(function () {
|
||||
// ── Theme-Init (synchron, vor allem anderen) ──────────────────────────────
|
||||
window._applyTheme = function (theme) {
|
||||
document.documentElement.setAttribute('data-theme', theme);
|
||||
};
|
||||
(function () {
|
||||
const saved = localStorage.getItem('xxx-theme');
|
||||
if (saved === 'light' || saved === 'dark') {
|
||||
window._applyTheme(saved);
|
||||
} else {
|
||||
const prefersLight = window.matchMedia('(prefers-color-scheme: light)').matches;
|
||||
window._applyTheme(prefersLight ? 'light' : 'dark');
|
||||
}
|
||||
})();
|
||||
window.matchMedia('(prefers-color-scheme: light)').addEventListener('change', function (e) {
|
||||
if (!localStorage.getItem('xxx-theme')) {
|
||||
window._applyTheme(e.matches ? 'light' : 'dark');
|
||||
}
|
||||
});
|
||||
|
||||
const path = window.location.pathname;
|
||||
const I = window.IC || function () { return ''; };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user