Skip to content

Commit 36f3416

Browse files
author
Giorgio Ruscigno
committed
Update JetpackPrologueStyleGuide, flip button colors and refactor all colors to make the code cleaner
1 parent 790a15b commit 36f3416

File tree

1 file changed

+55
-24
lines changed

1 file changed

+55
-24
lines changed

WordPress/Jetpack/Classes/NUX/JetpackPrologueStyleGuide.swift

Lines changed: 55 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,45 @@ import WordPressAuthenticator
55
/// The colors in here intentionally do not support light or dark modes since they're the same on both.
66
///
77
struct JetpackPrologueStyleGuide {
8-
static let backgroundColor = FeatureFlag.newLandingScreen.enabled ?
9-
UIColor(light: .muriel(color: .jetpackGreen, .shade5), dark: .muriel(color: .jetpackGreen, .shade100)):
10-
UIColor(red: 0.00, green: 0.11, blue: 0.18, alpha: 1.00)
8+
// Background colors
9+
// old
10+
static let oldBackgroundColor = UIColor(red: 0.00, green: 0.11, blue: 0.18, alpha: 1.00)
11+
// new
12+
static let newBackgroundColor = UIColor(light: .muriel(color: .jetpackGreen, .shade5), dark: .muriel(color: .jetpackGreen, .shade100))
13+
// combined
14+
static let backgroundColor = FeatureFlag.newLandingScreen.enabled ? newBackgroundColor : oldBackgroundColor
15+
16+
// Continue with WordPress button colors
17+
// old
18+
static let oldContinueHighlightedFillColor = UIColor(red: 1.00, green: 1.00, blue: 1.00, alpha: 0.90)
19+
// new
20+
static let newContinueFillColor = UIColor.muriel(color: .jetpackGreen, .shade50)
21+
static let newContinueHighlightedFillColor = UIColor.muriel(color: .jetpackGreen, .shade90)
22+
23+
// combined
24+
static let continueFillColor = FeatureFlag.newLandingScreen.enabled ? newContinueFillColor : .white
25+
static let continueHighlightedFillColor = FeatureFlag.newLandingScreen.enabled ? newContinueHighlightedFillColor : oldContinueHighlightedFillColor
26+
static let continueTextColor = FeatureFlag.newLandingScreen.enabled ? .white : oldBackgroundColor
27+
static let continueHighlightedTextColor = FeatureFlag.newLandingScreen.enabled ? whiteWithAlpha07 : oldBackgroundColor
28+
29+
30+
// Enter your site address button
31+
// old
32+
static let oldSiteBorderColor = UIColor(red: 1.00, green: 1.00, blue: 1.00, alpha: 0.40)
33+
static let oldSiteHighlightedBorderColor = UIColor(red: 1.00, green: 1.00, blue: 1.00, alpha: 0.20)
34+
// combined
35+
static let siteFillColor = FeatureFlag.newLandingScreen.enabled ? .white : backgroundColor
36+
static let siteBorderColor = FeatureFlag.newLandingScreen.enabled ? .white : oldSiteBorderColor
37+
static let siteTextColor = FeatureFlag.newLandingScreen.enabled ? UIColor.black : UIColor.white
38+
static let siteHighlightedFillColor = FeatureFlag.newLandingScreen.enabled ? whiteWithAlpha07 : backgroundColor
39+
static let siteHighlightedBorderColor = FeatureFlag.newLandingScreen.enabled ? whiteWithAlpha07 : oldSiteHighlightedBorderColor
40+
static let siteHighlightedTextColor = FeatureFlag.newLandingScreen.enabled ? .black : whiteWithAlpha07
41+
42+
// Color used in both old and versions
43+
static let whiteWithAlpha07 = UIColor.white.withAlphaComponent(0.7)
44+
45+
46+
1147

1248
struct Title {
1349
static let font: UIFont = WPStyleGuide.fontForTextStyle(.title3, fontWeight: .semibold)
@@ -24,32 +60,27 @@ struct JetpackPrologueStyleGuide {
2460
]
2561
}
2662

27-
static let continueButtonStyle = NUXButtonStyle(normal: .init(backgroundColor: .white,
28-
borderColor: .white,
29-
titleColor: FeatureFlag.newLandingScreen.enabled ? .black: Self.backgroundColor),
30-
31-
highlighted: .init(backgroundColor: UIColor(red: 1.00, green: 1.00, blue: 1.00, alpha: 0.90),
32-
borderColor: UIColor(red: 1.00, green: 1.00, blue: 1.00, alpha: 0.90),
33-
titleColor: FeatureFlag.newLandingScreen.enabled ? .black: Self.backgroundColor),
63+
static let continueButtonStyle = NUXButtonStyle(normal: .init(backgroundColor: continueFillColor,
64+
borderColor: continueFillColor,
65+
titleColor: continueTextColor),
66+
highlighted: .init(backgroundColor: continueHighlightedFillColor,
67+
borderColor: continueHighlightedFillColor,
68+
titleColor: continueHighlightedTextColor),
3469

35-
disabled: .init(backgroundColor: .white,
36-
borderColor: .white,
37-
titleColor: Self.backgroundColor))
70+
disabled: .init(backgroundColor: .white,
71+
borderColor: .white,
72+
titleColor: backgroundColor))
3873

39-
static let siteAddressButtonStyle = NUXButtonStyle(normal: .init(backgroundColor: FeatureFlag.newLandingScreen.enabled ?
40-
UIColor.muriel(color: .jetpackGreen, .shade50) :
41-
Self.backgroundColor,
42-
borderColor: FeatureFlag.newLandingScreen.enabled ? .clear : UIColor(red: 1.00, green: 1.00, blue: 1.00, alpha: 0.40),
43-
titleColor: .white),
74+
static let siteAddressButtonStyle = NUXButtonStyle(normal: .init(backgroundColor: siteFillColor,
75+
borderColor: siteBorderColor,
76+
titleColor: siteTextColor),
4477

45-
highlighted: .init(backgroundColor: FeatureFlag.newLandingScreen.enabled ?
46-
UIColor.muriel(color: .jetpackGreen, .shade90) :
47-
Self.backgroundColor,
48-
borderColor: FeatureFlag.newLandingScreen.enabled ? .clear : UIColor(red: 1.00, green: 1.00, blue: 1.00, alpha: 0.20),
49-
titleColor: UIColor.white.withAlphaComponent(0.7)),
78+
highlighted: .init(backgroundColor: siteHighlightedFillColor,
79+
borderColor: siteHighlightedBorderColor,
80+
titleColor: siteHighlightedTextColor),
5081

5182
disabled: .init(backgroundColor: .white,
5283
borderColor: .white,
53-
titleColor: Self.backgroundColor))
84+
titleColor: backgroundColor))
5485

5586
}

0 commit comments

Comments
 (0)