Skip to content

Instantly share code, notes, and snippets.

@hungtruong
Created September 29, 2019 20:32
Show Gist options
  • Save hungtruong/5a3c38401b0f8a5dffbaf543bdd67e31 to your computer and use it in GitHub Desktop.
Save hungtruong/5a3c38401b0f8a5dffbaf543bdd67e31 to your computer and use it in GitHub Desktop.
func color() -> UIColor {
switch self.highPower() {
case let p where p <= 0.6 :
return .gray
case let p where p < 0.76:
return .blue
case let p where p < 0.90:
return .green
case let p where p < 1.05:
return .yellow
case let p where p < 1.19:
return .orange
default:
return .red
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment