colorSchemeContrast
The contrast associated with the color scheme of this environment.
Declaration
var colorSchemeContrast: ColorSchemeContrast { get }Discussion
Read this environment value from within a view to find out if SwiftUI is currently displaying the view using ColorSchemeContrast.standard or ColorSchemeContrast.increased contrast. The value that you read depends entirely on user settings, and you can’t change it.
@Environment(\.colorSchemeContrast) private var colorSchemeContrast
var body: some View {
Text(colorSchemeContrast == .standard ? "Standard" : "Increased")
}When adjusting your app’s user interface to match the contrast, consider also checking the colorScheme property to find out if SwiftUI is displaying the view with a light or dark appearance. For information, see Accessibility in the Human Interface Guidelines.