diff --git a/meshmon.js b/meshmon.js index ef8edce..084a155 100644 --- a/meshmon.js +++ b/meshmon.js @@ -472,6 +472,9 @@ window.onload = function() { if (currentTheme === 'dark') { toggleSwitch.checked = true; } + } else if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + document.documentElement.setAttribute('data-theme', 'dark'); + toggleSwitch.checked = true; } toggleSwitch.addEventListener('change', switchTheme, false);