diff --git a/src/webui/www/private/css/style.css b/src/webui/www/private/css/style.css
index b99be2d02..dec15e1d3 100644
--- a/src/webui/www/private/css/style.css
+++ b/src/webui/www/private/css/style.css
@@ -19,19 +19,11 @@
--color-icon-hover: brightness(0) invert(100%) sepia(100%) saturate(0%)
hue-rotate(108deg) brightness(104%) contrast(104%);
- color-scheme: light dark;
-}
-
-/* Light corrections */
-@media (prefers-color-scheme: light) {
- :root {
+ &:not(.dark) {
color-scheme: light;
}
-}
-/* Dark corrections */
-@media (prefers-color-scheme: dark) {
- :root {
+ &.dark {
--color-accent-blue: hsl(210deg 42% 48%);
--color-text-blue: hsl(210deg 88.1% 73.5%);
--color-text-orange: hsl(26deg 65% 70%);
@@ -43,13 +35,13 @@
--color-border-default: hsl(0deg 0% 33%);
color-scheme: dark;
- }
- #rssButtonBar img,
- #startSearchButton img,
- #manageSearchPlugins img {
- filter: brightness(0) saturate(100%) invert(100%) sepia(0%) saturate(1%)
- hue-rotate(156deg) brightness(106%) contrast(101%);
+ #rssButtonBar img,
+ #startSearchButton img,
+ #manageSearchPlugins img {
+ filter: brightness(0) saturate(100%) invert(100%) sepia(0%)
+ saturate(1%) hue-rotate(156deg) brightness(106%) contrast(101%);
+ }
}
}
diff --git a/src/webui/www/private/index.html b/src/webui/www/private/index.html
index a92fbe29a..8905dc930 100644
--- a/src/webui/www/private/index.html
+++ b/src/webui/www/private/index.html
@@ -1,5 +1,6 @@
-
+
+
diff --git a/src/webui/www/private/scripts/client.js b/src/webui/www/private/scripts/client.js
index 1f3562caf..ed6eb51fd 100644
--- a/src/webui/www/private/scripts/client.js
+++ b/src/webui/www/private/scripts/client.js
@@ -1738,6 +1738,19 @@ window.addEventListener("load", () => {
window.qBittorrent.Cache.preferences.init();
window.qBittorrent.Cache.qbtVersion.init();
+ // Setup color scheme switching
+ const colorSchemeQuery = window.matchMedia("(prefers-color-scheme: dark)");
+ const updateColorScheme = () => {
+ const root = document.documentElement;
+ const colorScheme = LocalPreferences.get("color_scheme");
+ const validScheme = (colorScheme === "light") || (colorScheme === "dark");
+ const isDark = colorSchemeQuery.matches;
+ root.classList.toggle("dark", ((!validScheme && isDark) || (colorScheme === "dark")));
+ };
+
+ colorSchemeQuery.addEventListener("change", updateColorScheme);
+ updateColorScheme();
+
// switch to previously used tab
const previouslyUsedTab = LocalPreferences.get("selected_window_tab", "transfers");
switch (previouslyUsedTab) {
diff --git a/src/webui/www/private/views/preferences.html b/src/webui/www/private/views/preferences.html
index 1c112adcb..e9bb537e9 100644
--- a/src/webui/www/private/views/preferences.html
+++ b/src/webui/www/private/views/preferences.html
@@ -7,6 +7,16 @@
+
+