Skip to content

Instantly share code, notes, and snippets.

@aplekhanov
Last active January 21, 2024 17:17
Show Gist options
  • Save aplekhanov/e7d4c24e5adaa9b89adea32f9f96065c to your computer and use it in GitHub Desktop.
Save aplekhanov/e7d4c24e5adaa9b89adea32f9f96065c to your computer and use it in GitHub Desktop.
SwiftUI system colors extension
import SwiftUI
extension Color {
// MARK: - Text Colors
static let lightText = Color(UIColor.lightText.cgColor)
static let darkText = Color(UIColor.darkText.cgColor)
static let placeholderText = Color(UIColor.placeholderText.cgColor)
// MARK: - Label Colors
static let label = Color(UIColor.label.cgColor)
static let secondaryLabel = Color(UIColor.secondaryLabel.cgColor)
static let tertiaryLabel = Color(UIColor.tertiaryLabel.cgColor)
static let quaternaryLabel = Color(UIColor.quaternaryLabel.cgColor)
// MARK: - Background Colors
static let systemBackground = Color(UIColor.systemBackground.cgColor)
static let secondarySystemBackground = Color(UIColor.secondarySystemBackground.cgColor)
static let tertiarySystemBackground = Color(UIColor.tertiarySystemBackground.cgColor)
// MARK: - Fill Colors
static let systemFill = Color(UIColor.systemFill.cgColor)
static let secondarySystemFill = Color(UIColor.secondarySystemFill.cgColor)
static let tertiarySystemFill = Color(UIColor.tertiarySystemFill.cgColor)
static let quaternarySystemFill = Color(UIColor.quaternarySystemFill.cgColor)
// MARK: - Grouped Background Colors
static let systemGroupedBackground = Color(UIColor.systemGroupedBackground.cgColor)
static let secondarySystemGroupedBackground = Color(UIColor.secondarySystemGroupedBackground.cgColor)
static let tertiarySystemGroupedBackground = Color(UIColor.tertiarySystemGroupedBackground.cgColor)
// MARK: - Gray Colors
static let systemGray = Color(UIColor.systemGray.cgColor)
static let systemGray2 = Color(UIColor.systemGray2.cgColor)
static let systemGray3 = Color(UIColor.systemGray3.cgColor)
static let systemGray4 = Color(UIColor.systemGray4.cgColor)
static let systemGray5 = Color(UIColor.systemGray5.cgColor)
static let systemGray6 = Color(UIColor.systemGray6.cgColor)
// MARK: - Other Colors
static let separator = Color(UIColor.separator.cgColor)
static let opaqueSeparator = Color(UIColor.opaqueSeparator.cgColor)
static let link = Color(UIColor.link.cgColor)
// MARK: System Colors
static let systemBlue = Color(UIColor.systemBlue.cgColor)
static let systemPurple = Color(UIColor.systemPurple.cgColor)
static let systemGreen = Color(UIColor.systemGreen.cgColor)
static let systemYellow = Color(UIColor.systemYellow.cgColor)
static let systemOrange = Color(UIColor.systemOrange.cgColor)
static let systemPink = Color(UIColor.systemPink.cgColor)
static let systemRed = Color(UIColor.systemRed.cgColor)
static let systemTeal = Color(UIColor.systemTeal.cgColor)
static let systemIndigo = Color(UIColor.systemIndigo.cgColor)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment