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

isLuminanceReduced

A Boolean value that indicates whether the display currently requires reduced luminance.

Declaration 宣言

var isLuminanceReduced: Bool { get set }

Discussion 議論

The system typically sets this value to true on watchOS when the user lowers their wrist, but the display remains on. When you detect this condition, lower the overall brightness of your view. For example, you can change large, filled shapes to be stroked, and choose less bright colors:


@Environment(\.isLuminanceReduced) var isLuminanceReduced


var body: some View {
    if isLuminanceReduced {
        Circle()
            .stroke(Color.gray, lineWidth: 10)
    } else {
        Circle()
            .fill(Color.white)
    }
}

In addition to the changes that you make, the system might also dim the display to achieve a suitable brightness. By reacting to isLuminanceReduced, you can preserve contrast and readability while helping to satisfy the reduced brightness requirement.

See Also 参照

State 状態