Skip to content

Commit 47b0b06

Browse files
authored
Merge pull request #221 from mattrubin/text-colors
Fix text color bugs
2 parents 1e6d194 + 53e9058 commit 47b0b06

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

Authenticator/Source/ButtonHeaderView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class ButtonHeaderView<Action>: UIButton {
5757

5858
private func configureSubviews() {
5959
titleLabel?.textAlignment = .center
60-
titleLabel?.textColor = UIColor.otpForegroundColor
60+
setTitleColor(.otpForegroundColor, for: UIControlState.normal)
6161
titleLabel?.font = UIFont.systemFont(ofSize: 16, weight: UIFontWeightLight)
6262

6363
addTarget(self, action: #selector(ButtonHeaderView.buttonWasPressed), for: .touchUpInside)

Authenticator/Source/OTPAppDelegate.swift

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,17 @@ class OTPAppDelegate: UIResponder, UIApplicationDelegate {
3434
let app = AppController()
3535

3636
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
37-
let barButtonAttributes = [NSFontAttributeName: UIFont.systemFont(ofSize: 17, weight: UIFontWeightLight)]
38-
UIBarButtonItem.appearance().setTitleTextAttributes(barButtonAttributes, for: .normal)
37+
let barButtonItemFont = UIFont.systemFont(ofSize: 17, weight: UIFontWeightLight)
38+
let fontAttributes = [NSFontAttributeName: barButtonItemFont]
39+
UIBarButtonItem.appearance().setTitleTextAttributes(fontAttributes, for: .normal)
40+
UIBarButtonItem.appearance().setTitleTextAttributes(fontAttributes, for: .highlighted)
41+
UIBarButtonItem.appearance().setTitleTextAttributes(fontAttributes, for: .selected)
42+
43+
let disabledAttributes = [
44+
NSFontAttributeName: barButtonItemFont,
45+
NSForegroundColorAttributeName: UIColor.otpBarForegroundColor.withAlphaComponent(0.3),
46+
]
47+
UIBarButtonItem.appearance().setTitleTextAttributes(disabledAttributes, for: .disabled)
3948

4049
// Restore white-on-black style
4150
SVProgressHUD.setForegroundColor(.otpLightColor)

0 commit comments

Comments
 (0)