SwiftUI pick custom global systemBackground color

Viewed 165

I have been using the default background colors for light and dark mode, but I realized that the black color creates too much contrast in views with a lot of text.

I would like to change the default backgroundColor for dark mode to a slightly brighter black.

I've tried to create an extension for the Color struct and to overwrite the systemBackground color, but it didn't work.

The only solution I found is wrapping each view with the following:

ZStack {
    Color.myBackgroundColor.edgesIgnoringSafeArea(.all)
    ...
}

I would really like to avoid wrapping every single view with the colored ZStack. Is there any way to do that?

0 Answers
Related