MCPcopy Create free account
hub / github.com/cppla/ServerStatus / apply

Function apply

web/js/app.js:550–550  ·  view source on GitHub ↗
(light)

Source from the content-addressed store, hash-verified

548 const btn = $('themeToggle');
549 const mql = window.matchMedia('(prefers-color-scheme: light)');
550 const apply = (light) => { document.body.classList.toggle('light', light); document.documentElement.classList.toggle('light', light); };
551 const saved = localStorage.getItem('theme');
552 apply(saved ? saved === 'light' : mql.matches);
553 mql.addEventListener('change', e => { if(!localStorage.getItem('theme')) apply(e.matches); });

Callers 1

bindThemeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected