Предпочтительный темный режим: ColorScheme не обновляет кнопки ⇐ IOS
Предпочтительный темный режим: ColorScheme не обновляет кнопки
Does anyone know why this might be?
I am trying to give my users the option to set dark mode as a preference within the app.
I am using AppStorage to save the users choice and using preferredColorScheme on the Root view to update the entire app.
For the most part this is working and used to work fine. But since iOS 16/17 Buttons or NavigationLinks don't update their color. For example. I have a white system background that changes to black as expected but the text of all Buttons doesn't change and looks hidden on the black background. Yet normal text updates fine.
struct ContentView: View { @AppStorage("darkMode") var isDarkMode: Bool = false var body: some View { VStack { Text("Hello, world!") Button { // } label: { Text("click me") } Toggle("", isOn: $isDarkMode) } .padding() .preferredColorScheme(isDarkMode ? .dark : nil) } }
Источник: https://stackoverflow.com/questions/780 ... ng-buttons
Does anyone know why this might be?
I am trying to give my users the option to set dark mode as a preference within the app.
I am using AppStorage to save the users choice and using preferredColorScheme on the Root view to update the entire app.
For the most part this is working and used to work fine. But since iOS 16/17 Buttons or NavigationLinks don't update their color. For example. I have a white system background that changes to black as expected but the text of all Buttons doesn't change and looks hidden on the black background. Yet normal text updates fine.
struct ContentView: View { @AppStorage("darkMode") var isDarkMode: Bool = false var body: some View { VStack { Text("Hello, world!") Button { // } label: { Text("click me") } Toggle("", isOn: $isDarkMode) } .padding() .preferredColorScheme(isDarkMode ? .dark : nil) } }
Источник: https://stackoverflow.com/questions/780 ... ng-buttons
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Принудительно использовать светлый режим, когда браузер установлен в темный режим
Anonymous » » в форуме CSS - 0 Ответы
- 53 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Принудительно использовать светлый режим, когда браузер установлен в темный режим
Anonymous » » в форуме CSS - 0 Ответы
- 57 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Динамическое изменение темы Highlight.js с помощью кнопки переключения (светлый/темный режим)
Anonymous » » в форуме CSS - 0 Ответы
- 57 Просмотры
-
Последнее сообщение Anonymous
-