Skip to content

Instantly share code, notes, and snippets.

@sturdysturge
Created July 25, 2022 21:23
Show Gist options
  • Save sturdysturge/0bc71b8eccef992809d42ce5a978aa66 to your computer and use it in GitHub Desktop.
Save sturdysturge/0bc71b8eccef992809d42ce5a978aa66 to your computer and use it in GitHub Desktop.
struct ColourSchemeSection: View {
let colourScheme: ColorScheme
var colourSchemeName: String {
colourScheme == .dark ? "Dark" : "Light"
}
var body: some View {
Section("\(colourSchemeName) Colour Scheme") {
Text("Primary Foreground, Secondary Background")
.foregroundColor(.primary)
.background(Color.secondary)
Text("Secondary Foreground, Primary Background")
.foregroundColor(.secondary)
.background(Color.primary)
}
.preferredColorScheme(colourScheme)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment