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

Commit 5e659c2

Browse files
nheagyjkmassel
authored andcommitted
Merge pull request #107 from wordpress-mobile/issues/11683-more-color-changes
Make remaining colors configurable
2 parents d4c6642 + 9a62ae3 commit 5e659c2

19 files changed

+106
-70
lines changed

WordPressAuthenticator.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "WordPressAuthenticator"
3-
s.version = "1.6.0-beta.1"
3+
s.version = "1.7.0-beta.1"
44
s.summary = "WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps."
55

66
s.description = <<-DESC

WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ import WordPressUI
7070
/// Initializes the WordPressAuthenticator with the specified Configuration.
7171
///
7272
public static func initialize(configuration: WordPressAuthenticatorConfiguration,
73-
style: WordPressAuthenticatorStyle = .defaultStyle,
73+
style: WordPressAuthenticatorStyle,
7474
displayStrings: WordPressAuthenticatorDisplayStrings = .defaultStrings) {
7575
guard privateInstance == nil else {
7676
fatalError("WordPressAuthenticator is already initialized")

WordPressAuthenticator/Authenticator/WordPressAuthenticatorStyles.swift

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,20 @@ public struct WordPressAuthenticatorStyle {
3939

4040
public let disabledTitleColor: UIColor
4141

42-
/// Style: Subheadline
42+
/// Style: Text Buttons
4343
///
44+
public let textButtonColor: UIColor
45+
46+
public let textButtonHighlightColor: UIColor
47+
48+
/// Style: Labels
49+
///
50+
public let instructionColor: UIColor
51+
4452
public let subheadlineColor: UIColor
4553

54+
public let placeholderColor: UIColor
55+
4656
/// Style: Login screen background colors
4757
///
4858
public let viewControllerBackgroundColor: UIColor
@@ -61,7 +71,7 @@ public struct WordPressAuthenticatorStyle {
6171

6272
/// Designated initializer
6373
///
64-
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, viewControllerBackgroundColor: UIColor, navBarImage: UIImage, prologueBackgroundColor: UIColor = WPStyleGuide.wordPressBlue(), prologueTitleColor: UIColor = .white) {
74+
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, textButtonColor: UIColor, textButtonHighlightColor: UIColor, instructionColor: UIColor, subheadlineColor: UIColor, placeholderColor: UIColor, viewControllerBackgroundColor: UIColor, navBarImage: UIImage, prologueBackgroundColor: UIColor = WPStyleGuide.wordPressBlue(), prologueTitleColor: UIColor = .white) {
6575
self.primaryNormalBackgroundColor = primaryNormalBackgroundColor
6676
self.primaryNormalBorderColor = primaryNormalBorderColor
6777
self.primaryHighlightBackgroundColor = primaryHighlightBackgroundColor
@@ -75,32 +85,14 @@ public struct WordPressAuthenticatorStyle {
7585
self.primaryTitleColor = primaryTitleColor
7686
self.secondaryTitleColor = secondaryTitleColor
7787
self.disabledTitleColor = disabledTitleColor
88+
self.textButtonColor = textButtonColor
89+
self.textButtonHighlightColor = textButtonHighlightColor
90+
self.instructionColor = instructionColor
7891
self.subheadlineColor = subheadlineColor
92+
self.placeholderColor = placeholderColor
7993
self.viewControllerBackgroundColor = viewControllerBackgroundColor
8094
self.navBarImage = navBarImage
8195
self.prologueBackgroundColor = prologueBackgroundColor
8296
self.prologueTitleColor = prologueTitleColor
8397
}
8498
}
85-
86-
public extension WordPressAuthenticatorStyle {
87-
static var defaultStyle: WordPressAuthenticatorStyle {
88-
return WordPressAuthenticatorStyle(primaryNormalBackgroundColor: WPStyleGuide.mediumBlue(),
89-
primaryNormalBorderColor: WPStyleGuide.wordPressBlue(),
90-
primaryHighlightBackgroundColor: WPStyleGuide.wordPressBlue(),
91-
primaryHighlightBorderColor: WPStyleGuide.wordPressBlue(),
92-
secondaryNormalBackgroundColor: UIColor.white,
93-
secondaryNormalBorderColor: WPStyleGuide.greyLighten20(),
94-
secondaryHighlightBackgroundColor: WPStyleGuide.greyLighten20(),
95-
secondaryHighlightBorderColor: WPStyleGuide.greyLighten20(),
96-
disabledBackgroundColor: UIColor.white,
97-
disabledBorderColor: WPStyleGuide.greyLighten30(),
98-
primaryTitleColor: UIColor.white,
99-
secondaryTitleColor: WPStyleGuide.darkGrey(),
100-
disabledTitleColor: WPStyleGuide.greyLighten30(),
101-
subheadlineColor: WPStyleGuide.wordPressBlue(),
102-
viewControllerBackgroundColor: WPStyleGuide.lightGrey(),
103-
navBarImage: Gridicon.iconOfType(.mySites)
104-
)
105-
}
106-
}

WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ 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)
10+
setTitleColor(WordPressAuthenticator.shared.style.textButtonColor, for: .normal)
11+
setTitleColor(WordPressAuthenticator.shared.style.textButtonHighlightColor, for: .highlighted)
1112
}
1213
}
1314
}
@@ -103,8 +104,8 @@ extension WPStyleGuide {
103104
class func googleLoginButton() -> UIButton {
104105
let baseString = NSLocalizedString("{G} Log in with Google.", comment: "Label for button to log in using Google. The {G} will be replaced with the Google logo.")
105106

106-
let attrStrNormal = googleButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.primaryNormalBorderColor)
107-
let attrStrHighlight = googleButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.primaryHighlightBorderColor)
107+
let attrStrNormal = googleButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.textButtonColor)
108+
let attrStrHighlight = googleButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.textButtonHighlightColor)
108109

109110
let font = WPStyleGuide.mediumWeightFont(forStyle: .subheadline)
110111

@@ -118,8 +119,8 @@ extension WPStyleGuide {
118119
class func selfHostedLoginButton() -> UIButton {
119120
let baseString = NSLocalizedString("Log in by entering your site address.", comment: "Label for button to log in using your site address.")
120121

121-
let attrStrNormal = selfHostedButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.primaryNormalBorderColor)
122-
let attrStrHighlight = selfHostedButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.primaryHighlightBorderColor)
122+
let attrStrNormal = selfHostedButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.textButtonColor)
123+
let attrStrHighlight = selfHostedButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.textButtonHighlightColor)
123124

124125
let font = WPStyleGuide.mediumWeightFont(forStyle: .subheadline)
125126

@@ -210,7 +211,7 @@ extension WPStyleGuide {
210211

211212
let labelString = NSMutableAttributedString(string: "")
212213

213-
if let originalDomainsIcon = Gridicon.iconOfType(.domains).imageWithTintColor(WPStyleGuide.greyLighten10()) {
214+
if let originalDomainsIcon = Gridicon.iconOfType(.domains).imageWithTintColor(WordPressAuthenticator.shared.style.placeholderColor) {
214215
var domainsIcon = originalDomainsIcon.cropping(to: CGRect(x: Constants.domainsIconPaddingToRemove,
215216
y: Constants.domainsIconPaddingToRemove,
216217
width: originalDomainsIcon.size.width - Constants.domainsIconPaddingToRemove * 2,

WordPressAuthenticator/NUX/NUXLinkMailViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class NUXLinkMailViewController: LoginViewController {
7373
return NSLocalizedString("We sent you a magic signup link! Check your email on this device, and tap the link in the email to finish signing up.", comment: "Instructional text on how to open the email containing a magic link.")
7474
}
7575
}()
76+
label?.textColor = WordPressAuthenticator.shared.style.instructionColor
7677
}
7778

7879
// MARK: - Dynamic type

WordPressAuthenticator/NUX/WPWalkthroughTextField.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ - (void)commonInit
8888

8989
// Apply styles to the placeholder if one was set in IB.
9090
if (self.placeholder) {
91+
// colors here are overridden in LoginTextField
9192
NSDictionary *attributes = @{
9293
NSForegroundColorAttributeName : WPStyleGuide.greyLighten10,
9394
NSFontAttributeName : self.font,
@@ -110,6 +111,7 @@ - (void)configureSecureTextEntryToggle {
110111

111112
self.secureTextEntryToggle = [UIButton buttonWithType:UIButtonTypeCustom];
112113
self.secureTextEntryToggle.clipsToBounds = true;
114+
// colors here are overridden in LoginTextField
113115
self.secureTextEntryToggle.tintColor = [WPStyleGuide greyLighten10];
114116
[self.secureTextEntryToggle addTarget:self action:@selector(secureTextEntryToggleAction:) forControlEvents:UIControlEventTouchUpInside];
115117

@@ -146,7 +148,6 @@ - (void)drawRect:(CGRect)rect
146148
CGContextAddPath(context, path.CGPath);
147149
CGContextSetStrokeColorWithColor(context, [UIColor colorWithWhite:0.87 alpha:1.0].CGColor);
148150
CGContextStrokePath(context);
149-
150151
}
151152

152153

0 commit comments

Comments
 (0)