From ec0527df6f7d5d6922156e275bcbb7e3bf50a745 Mon Sep 17 00:00:00 2001 From: DigitallyRefined <129616584+DigitallyRefined@users.noreply.github.com> Date: Wed, 24 Dec 2025 19:56:20 +0000 Subject: [PATCH 1/2] Auto detect dark mode --- DnsServerCore/www/js/main.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/DnsServerCore/www/js/main.js b/DnsServerCore/www/js/main.js index 8518f1d5..28cb7c5c 100644 --- a/DnsServerCore/www/js/main.js +++ b/DnsServerCore/www/js/main.js @@ -2871,6 +2871,10 @@ function applyTheme() { if (currentTheme === "dark") document.body.classList.add("dark-mode"); + else if (currentTheme === "light") + document.body.classList.remove("dark-mode"); + else if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) + document.body.classList.add("dark-mode"); else document.body.classList.remove("dark-mode"); } From 6f6d9e4591050d082a51daaf109965ee69ea370b Mon Sep 17 00:00:00 2001 From: DigitallyRefined <129616584+DigitallyRefined@users.noreply.github.com> Date: Wed, 24 Dec 2025 20:22:41 +0000 Subject: [PATCH 2/2] Auto switch when system dark mode changes --- DnsServerCore/www/js/main.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/DnsServerCore/www/js/main.js b/DnsServerCore/www/js/main.js index 28cb7c5c..5d832ebb 100644 --- a/DnsServerCore/www/js/main.js +++ b/DnsServerCore/www/js/main.js @@ -2879,6 +2879,12 @@ function applyTheme() { document.body.classList.remove("dark-mode"); } +if (window.matchMedia && !localStorage.getItem("theme")) { + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => { + applyTheme(); + }); +} + function toggleTheme() { document.body.classList.toggle("dark-mode");