1const pointTheme = document.querySelector('html'); 2const THEME = { 3 DARK: 'dark', 4 LIGHT: 'light', 5 AUTO: 'auto', 6}; 7 8setTheme = (mode) => { 9 switch (mode) { 10 case THEME.DARK: { 11 pointTheme.setAttribute('data-bs-theme', THEME.DARK); 12 return; 13 } 14 case THEME.LIGHT: { 15 pointTheme.setAttribute('data-bs-theme', THEME.LIGHT); 16 return; 17 } 18 case THEME.AUTO: 19 default: { 20 const isDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches; 21 22 if(isDark) { 23 pointTheme.setAttribute('data-bs-theme', THEME.DARK); 24 } else { 25 pointTheme.setAttribute('data-bs-theme', THEME.LIGHT); 26 } 27 return; 28 } 29 } 30}; 31 32initTheme = () => { 33 setTheme(THEME.AUTO); 34}; 35 36initTheme();
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.