From 691b3f26678c2fe3808489554933dd3fe619cea2 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Sat, 21 Jan 2023 15:54:15 +0100 Subject: [PATCH] Theme: Refresh theme on launch if following color scheme --- Packages/DesignSystem/Sources/DesignSystem/ThemeApplier.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Packages/DesignSystem/Sources/DesignSystem/ThemeApplier.swift b/Packages/DesignSystem/Sources/DesignSystem/ThemeApplier.swift index 80133c99..c228f53e 100644 --- a/Packages/DesignSystem/Sources/DesignSystem/ThemeApplier.swift +++ b/Packages/DesignSystem/Sources/DesignSystem/ThemeApplier.swift @@ -31,6 +31,10 @@ struct ThemeApplier: ViewModifier { if !theme.isThemePreviouslySet { theme.selectedSet = colorScheme == .dark ? .iceCubeDark : .iceCubeLight theme.isThemePreviouslySet = true + } else if theme.followSystemColorScheme && theme.isThemePreviouslySet, + let sets = availableColorsSets + .first(where: { $0.light.name == theme.selectedSet || $0.dark.name == theme.selectedSet }) { + theme.selectedSet = colorScheme == .dark ? sets.dark.name : sets.light.name } setWindowTint(theme.tintColor) setBarsColor(theme.primaryBackgroundColor)