Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

Commit 5b6cb16

Browse files
authored
Merge pull request #16 from wordpress-mobile/feature/subheadline-button-appearance
Configure subheadline button title color
2 parents b834110 + 3aecb1c commit 5b6cb16

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

WordPressAuthenticator/Authenticator/WordPressAuthenticatorStyles.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,13 @@ public struct WordPressAuthenticatorStyle {
3737

3838
public let disabledTitleColor: UIColor
3939

40+
/// Style: Subheadline
41+
///
42+
public let subheadlineColor: UIColor
43+
4044
/// Designated initializer
4145
///
42-
public init(primaryNormalBackgroundColor: UIColor, primaryNormalBorderColor: UIColor, primaryHighlightBackgroundColor: UIColor, primaryHighlightBorderColor: UIColor, secondaryNormalBackgroundColor: UIColor, secondaryNormalBorderColor: UIColor, secondaryHighlightBackgroundColor: UIColor, secondaryHighlightBorderColor: UIColor, disabledBackgroundColor: UIColor, disabledBorderColor: UIColor, primaryTitleColor: UIColor, secondaryTitleColor: UIColor, disabledTitleColor: UIColor) {
46+
public init(primaryNormalBackgroundColor: UIColor, primaryNormalBorderColor: UIColor, primaryHighlightBackgroundColor: UIColor, primaryHighlightBorderColor: UIColor, secondaryNormalBackgroundColor: UIColor, secondaryNormalBorderColor: UIColor, secondaryHighlightBackgroundColor: UIColor, secondaryHighlightBorderColor: UIColor, disabledBackgroundColor: UIColor, disabledBorderColor: UIColor, primaryTitleColor: UIColor, secondaryTitleColor: UIColor, disabledTitleColor: UIColor, subheadlineColor: UIColor) {
4347
self.primaryNormalBackgroundColor = primaryNormalBackgroundColor
4448
self.primaryNormalBorderColor = primaryNormalBorderColor
4549
self.primaryHighlightBackgroundColor = primaryHighlightBackgroundColor
@@ -53,6 +57,7 @@ public struct WordPressAuthenticatorStyle {
5357
self.primaryTitleColor = primaryTitleColor
5458
self.secondaryTitleColor = secondaryTitleColor
5559
self.disabledTitleColor = disabledTitleColor
60+
self.subheadlineColor = subheadlineColor
5661
}
5762
}
5863

@@ -70,6 +75,7 @@ public extension WordPressAuthenticatorStyle {
7075
disabledBorderColor: WPStyleGuide.greyLighten30(),
7176
primaryTitleColor: UIColor.white,
7277
secondaryTitleColor: WPStyleGuide.darkGrey(),
73-
disabledTitleColor: WPStyleGuide.greyLighten30())
78+
disabledTitleColor: WPStyleGuide.greyLighten30(),
79+
subheadlineColor: WPStyleGuide.wordPressBlue())
7480
}
7581
}

WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ final class SubheadlineButton: UIButton {
77
super.traitCollectionDidChange(previousTraitCollection)
88
if previousTraitCollection?.preferredContentSizeCategory != traitCollection.preferredContentSizeCategory {
99
titleLabel?.font = WPStyleGuide.mediumWeightFont(forStyle: .subheadline)
10+
setTitleColor(WordPressAuthenticator.shared.style.subheadlineColor, for: .normal)
1011
}
1112
}
1213
}
@@ -162,6 +163,7 @@ extension WPStyleGuide {
162163
button.titleLabel?.font = font
163164
button.titleLabel?.numberOfLines = 0
164165
button.titleLabel?.lineBreakMode = .byWordWrapping
166+
button.setTitleColor(WordPressAuthenticator.shared.style.subheadlineColor, for: .normal)
165167

166168
// These constraints work around some issues with multiline buttons and
167169
// vertical layout. Without them the button's height may not account

0 commit comments

Comments
 (0)