Add an iPhone client sharing the macOS app's SwiftUI code
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import AppKit
|
||||
import SwiftUI
|
||||
|
||||
enum Palette {
|
||||
@@ -29,17 +28,13 @@ enum Palette {
|
||||
static let task10 = dynamic(0x942e79, 0xf59cd8)
|
||||
|
||||
static let overlayBackdrop = Color.black.opacity(0.35)
|
||||
static let overlayShadow = Color(nsColor: NSColor(name: nil) { appearance in
|
||||
appearance.bestMatch(from: [.aqua, .darkAqua]) == .darkAqua ? NSColor(srgbRed: 0, green: 0, blue: 0, alpha: 0.5) : NSColor(srgbRed: 16 / 255, green: 24 / 255, blue: 40 / 255, alpha: 0.18)
|
||||
})
|
||||
static let overlayShadow = Color(PlatformColor.dynamic(light: PlatformColor(red: 16 / 255, green: 24 / 255, blue: 40 / 255, alpha: 0.18), dark: PlatformColor(red: 0, green: 0, blue: 0, alpha: 0.5)))
|
||||
|
||||
private static func rgb(_ hex: UInt32) -> NSColor {
|
||||
NSColor(srgbRed: CGFloat(hex >> 16 & 0xff) / 255, green: CGFloat(hex >> 8 & 0xff) / 255, blue: CGFloat(hex & 0xff) / 255, alpha: 1)
|
||||
private static func rgb(_ hex: UInt32) -> PlatformColor {
|
||||
PlatformColor(red: CGFloat(hex >> 16 & 0xff) / 255, green: CGFloat(hex >> 8 & 0xff) / 255, blue: CGFloat(hex & 0xff) / 255, alpha: 1)
|
||||
}
|
||||
|
||||
private static func dynamic(_ light: UInt32, _ dark: UInt32) -> Color {
|
||||
Color(nsColor: NSColor(name: nil) { appearance in
|
||||
appearance.bestMatch(from: [.aqua, .darkAqua]) == .darkAqua ? rgb(dark) : rgb(light)
|
||||
})
|
||||
Color(PlatformColor.dynamic(light: rgb(light), dark: rgb(dark)))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user