Skip to content

Instantly share code, notes, and snippets.

@mdb1
Last active December 26, 2022 14:16
Show Gist options
  • Save mdb1/2334c5f872223a514be8d32a9a1461fd to your computer and use it in GitHub Desktop.
Save mdb1/2334c5f872223a514be8d32a9a1461fd to your computer and use it in GitHub Desktop.
Color Extension SwiftUI
import SwiftUI
/// Namespaces.
extension Color {
/// Colors for Texts.
enum Text {}
/// Colors for Backgrounds
enum Background {}
/// Colors for Borders.
enum Border {}
}
// MARK: - General Colors
extension Color {
static let appPrimary = Color("appPrimary")
static let appSecondary = Color("appSecondary")
}
// MARK: - Text Colors
extension Color.Text {
static let primary = Color("textPrimary")
}
// MARK: - Background Colors
extension Color.Background {
static let primary = Color("backgroundPrimary")
}
// MARK: - Border Colors
extension Color.Border {
static let `default` = Color("border")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment