Skip to content

Instantly share code, notes, and snippets.

@laevandus
Last active August 30, 2020 00:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laevandus/12412ff13423c2822cb3ebc427348d89 to your computer and use it in GitHub Desktop.
Save laevandus/12412ff13423c2822cb3ebc427348d89 to your computer and use it in GitHub Desktop.
import ColorContrastRatio
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Text("Luminance for red color").padding()
Rectangle()
.frame(width: 50, height: 50)
.fixedSize()
.foregroundColor(.red)
Text("\(UIColor.red.relativeLuminance)")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment