Last active
May 1, 2022 17:29
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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