Fix system theme pair integration

This commit is contained in:
Yuri Karamian
2026-08-06 15:12:43 +02:00
parent aeddcc6e58
commit 1950c4cc3c
8 changed files with 73 additions and 52 deletions
+6 -1
View File
@@ -102,8 +102,13 @@ export const resolvedTheme = derived(
[theme, appConfig, systemPrefersDark],
([$theme, $config, $prefersDark]): string => {
if ($theme !== "system") return $theme;
const fallback = $prefersDark ? "dark" : "light";
const paired = $prefersDark ? $config?.system_dark_theme : $config?.system_light_theme;
return paired || ($prefersDark ? "dark" : "light");
if (!paired) return fallback;
if (paired.startsWith("custom-") && !$config?.custom_themes.some((item) => item.id === paired)) {
return fallback;
}
return paired;
},
);