WebUI: fix color scheme for iframes

Applies the color scheme for iframe dialogs.

Fixup for #21613.
PR #21750.
This commit is contained in:
Hanabishi 2024-11-09 13:02:28 +05:00 committed by GitHub
commit 06fe3e5fb0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 133 additions and 38 deletions

View file

@ -1760,19 +1760,6 @@ 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) {