PageSourceSearch

https://zwindler.fr/js/color-scheme.js

js zwindler.fr collected 2026-09-25 15:23:47 UTC 625 bytes, 16 lines download raw bytes

1(function() {
2    const colorSchemeKey = 'StackColorScheme';
3    if(!localStorage.getItem(colorSchemeKey)){
4        localStorage.setItem(colorSchemeKey, "auto");
5    }
6})();
7(function() {
8    const colorSchemeKey = 'StackColorScheme';
9    const colorSchemeItem = localStorage.getItem(colorSchemeKey);
10    const supportDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches === true;
11    if (colorSchemeItem == 'dark' || colorSchemeItem === 'auto' && supportDarkMode) {
12        document.documentElement.dataset.scheme = 'dark';
13    } else {
14        document.documentElement.dataset.scheme = 'light';
15    }
16})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.