-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathConnectButton+Style.swift
61 lines (50 loc) · 1.78 KB
/
ConnectButton+Style.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
55
56
57
58
59
60
61
//
// ConnectButton+Style.swift
// IFTTT SDK
//
// Copyright © 2019 IFTTT. All rights reserved.
//
import UIKit
extension ConnectButton {
/// Adjusts the button for a white or black background
///
/// - light: Style the button for a white background
public enum Style {
/// Style the button for a white background
case light
/// Style the button for a dark background
case dark
/// Style the button for with dynamic colors:
/// When the user device is on light mode, the style used is equivalent to `light`.
/// When on dark mode, the style is equivalent to `dark`.
///
/// On iOS versions before 13.0, this style is the same as `light`.
case dynamic
struct Font {
static let connect = UIFont(name: "AvenirNext-Bold", size: 22)!
static let email = UIFont(name: "AvenirNext-DemiBold", size: 18)!
}
/// The color to use for the footer based on the style.
var footerColor: UIColor {
return UIColor(hex: 0x999999)
}
/// The color to use for the button background based on the style
var buttonBackgroundColor: UIColor {
return colors(light: Color.almostBlack, dark: .white)
}
/// The color to use for the button text based on the style
var textColor: UIColor {
return colors(light: .white, dark: .black)
}
private func colors(light: UIColor, dark: UIColor) -> UIColor {
switch self {
case .light:
return light
case .dark:
return dark
case .dynamic:
return Color.dynamicColor(light: light, dark: dark)
}
}
}
}