Initialized repo

This commit is contained in:
2025-12-12 02:05:10 +01:00
commit aebc8a830b
6 changed files with 190 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
/**
* Detects system/browser color scheme and sets the "style_variant" cookie accordingly.
* Reloads the page if the variant changes.
*/
(function () {
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
const cookie = document.cookie.split('; ').find(r => r.startsWith('style_variant='));
const current = cookie ? cookie.split('=')[1] : '';
const desired = prefersDark ? '01-evening' : 'default'; // Customize variant names as needed
if (current !== desired) {
document.cookie = "style_variant=" + desired + "; path=/; max-age=31536000";
location.reload();
}
})();