Instance Property インスタンスプロパティ

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 about using color and contrast in your app, see Color and Contrast.

See Also 参照

Display Characteristics