-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathConnectButton+Constants.swift
54 lines (46 loc) · 1.71 KB
/
ConnectButton+Constants.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//
// ConnectButton+Constants.swift
// IFTTT SDK
//
// Copyright © 2019 IFTTT. All rights reserved.
//
import UIKit
public typealias VoidClosure = () -> Void
extension ConnectButton {
// Layout constants
struct Layout {
static let height: CGFloat = 72
static let maximumWidth = 5.0 * height
static let knobInset: CGFloat = borderWidth
static let knobDiameter = height - 2 * knobInset
static let checkmarkDiameter: CGFloat = 42
static let checkmarkLength: CGFloat = 14
static let serviceIconDiameter = 0.5 * knobDiameter
/// The thickness of the border around the the connect button.
static let borderWidth: CGFloat = 4
/// The amount by which the email field is offset from the center
static let emailFieldOffset: CGFloat = 4
static let buttonFooterSpacing: CGFloat = 15
}
struct Color {
static let blue = UIColor(hex: 0x0099FF)
static let lightGrey = UIColor(hex: 0xCCCCCC)
static let mediumGrey = UIColor(hex: 0x666666)
static let grey = UIColor(hex: 0x414141)
static let border = UIColor(white: 1, alpha: 0.32)
static let almostBlack = UIColor(hex: 0x222222)
static func dynamicColor(light: UIColor, dark: UIColor) -> UIColor {
if #available(iOS 13, *) {
return UIColor { (UITraitCollection: UITraitCollection) -> UIColor in
if UITraitCollection.userInterfaceStyle == .dark {
return dark
} else {
return light
}
}
} else {
return light
}
}
}
}