yattee/Extensions/Color+Background.swift

16 lines
519 B
Swift
Raw Normal View History

2021-11-28 14:37:55 +00:00
import SwiftUI
extension Color {
#if os(macOS)
static let background = Color(NSColor.windowBackgroundColor)
static let secondaryBackground = Color(NSColor.controlBackgroundColor)
2021-11-28 14:37:55 +00:00
#elseif os(iOS)
static let background = Color(UIColor.systemBackground)
static let secondaryBackground = Color(UIColor.secondarySystemBackground)
#else
static func background(scheme: ColorScheme) -> Color {
scheme == .dark ? .black : .init(white: 0.8)
}
2021-11-28 14:37:55 +00:00
#endif
}