Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 839 Bytes

color-scheme.md

File metadata and controls

32 lines (22 loc) · 839 Bytes

colorScheme

Screen Shot 2022-10-31 at 4 37 14 PM

try? it out

import SwiftUI

struct ContentView: View {

    // Apple docs:
    // https://developer.apple.com/documentation/swiftui/environmentvalues/colorscheme
    @Environment(\.colorScheme) var colorScheme

    var body: some View {
        Text(colorScheme == .dark ? "Dark" : "Light")
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

Resources