Skip to content

Instantly share code, notes, and snippets.

@andresr-dev
Last active May 1, 2022 17:29
Show Gist options
  • Save andresr-dev/e2a8047f947c285906ebd56eecb13245 to your computer and use it in GitHub Desktop.
Save andresr-dev/e2a8047f947c285906ebd56eecb13245 to your computer and use it in GitHub Desktop.
This ShapeStyle extension helps you to use your custom colors in a very easy way
import SwiftUI
extension ShapeStyle where Self == Color {
static var darkBackground: Color {
Color(red: 0.1, green: 0.1, blue: 0.2)
}
}
// HOW TO USE IT
struct ContentView: View {
var body: some View {
Rectangle()
.fill(.darkBackground)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment