case light
The color scheme that corresponds to a light appearance.
case dark
The color scheme that corresponds to a dark appearance.
Availability 有効性
Technology
enum ColorScheme
You receive a color scheme value when you read the color
environment value. The value tells you if a light or dark appearance currently applies to the view. SwiftUI updates the value whenever the appearance changes, and redraws views that depend on the value. For example, the following Text
view automatically updates when the user enables Dark Mode:
private var colorScheme (\.colorScheme)
var body: some View {
Text(colorScheme == .dark ? "Dark" : "Light")
}
Set a preferred appearance for a particular view hierarchy to override the user’s Dark Mode setting using the preferred
view modifier.
case light
case dark
init?(UIUserInterfaceStyle )
static var allCases : [ColorScheme ]
typealias AllCases
static func == (ColorScheme , ColorScheme ) -> Bool
static func != (Self, Self) -> Bool
func hash(into: inout Hasher)
var hashValue : Int
struct PreferredColorSchemeKey
enum ColorSchemeContrast
enum EditMode
enum UserInterfaceSizeClass