From 5719aba91a0aade98edd88781b52bdebe22883c4 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Fri, 29 Jun 2018 17:47:04 -0600 Subject: [PATCH] separate icon vs. title color for toolbars --- .../ConversationView/ConversationHeaderView.swift | 4 ++-- .../ConversationView/ConversationViewController.m | 8 ++++---- .../src/ViewControllers/HomeView/HomeViewController.m | 2 +- .../src/ViewControllers/MediaPageViewController.swift | 4 ++-- SignalMessaging/categories/UIColor+OWS.h | 3 ++- SignalMessaging/categories/UIColor+OWS.m | 11 +++++++---- SignalMessaging/categories/UIViewController+OWS.m | 2 +- SignalMessaging/utils/UIUtil.m | 10 ++++------ 8 files changed, 23 insertions(+), 21 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/ConversationHeaderView.swift b/Signal/src/ViewControllers/ConversationView/ConversationHeaderView.swift index 85e25980b..abc37ce7f 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationHeaderView.swift +++ b/Signal/src/ViewControllers/ConversationView/ConversationHeaderView.swift @@ -64,13 +64,13 @@ public class ConversationHeaderView: UIStackView { avatarView.layer.borderWidth = 0 titleLabel = UILabel() - titleLabel.textColor = .ows_navbarForeground + titleLabel.textColor = .ows_navbarTitle titleLabel.lineBreakMode = .byTruncatingTail titleLabel.font = titlePrimaryFont titleLabel.setContentHuggingHigh() subtitleLabel = UILabel() - subtitleLabel.textColor = .ows_navbarForeground + subtitleLabel.textColor = .ows_navbarTitle subtitleLabel.lineBreakMode = .byTruncatingTail subtitleLabel.font = subtitleFont subtitleLabel.setContentHuggingHigh() diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index 2b9ee898d..0ba61c8ff 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -1321,11 +1321,11 @@ typedef enum : NSUInteger { if (OWSWindowManager.sharedManager.hasCall) { callButton.enabled = NO; callButton.userInteractionEnabled = NO; - callButton.tintColor = [UIColor.ows_navbarForegroundColor colorWithAlphaComponent:0.7]; + callButton.tintColor = [UIColor.ows_navbarIconColor colorWithAlphaComponent:0.7]; } else { callButton.enabled = YES; callButton.userInteractionEnabled = YES; - callButton.tintColor = UIColor.ows_navbarForegroundColor; + callButton.tintColor = UIColor.ows_navbarIconColor; } UIEdgeInsets imageEdgeInsets = UIEdgeInsetsZero; @@ -1353,7 +1353,7 @@ typedef enum : NSUInteger { DisappearingTimerConfigurationView *timerView = [[DisappearingTimerConfigurationView alloc] initWithDurationSeconds:self.disappearingMessagesConfiguration.durationSeconds]; timerView.delegate = self; - timerView.tintColor = UIColor.ows_navbarForegroundColor; + timerView.tintColor = UIColor.ows_navbarIconColor; // As of iOS11, we can size barButton item custom views with autoLayout. // Before that, though we can still use autoLayout *within* the customView, @@ -1375,7 +1375,7 @@ typedef enum : NSUInteger { { NSMutableAttributedString *subtitleText = [NSMutableAttributedString new]; - UIColor *subtitleColor = [UIColor.ows_navbarForegroundColor colorWithAlphaComponent:(CGFloat)0.9]; + UIColor *subtitleColor = [UIColor.ows_navbarTitleColor colorWithAlphaComponent:(CGFloat)0.9]; if (self.thread.isMuted) { // Show a "mute" icon before the navigation bar subtitle if this thread is muted. [subtitleText diff --git a/Signal/src/ViewControllers/HomeView/HomeViewController.m b/Signal/src/ViewControllers/HomeView/HomeViewController.m index b25059a1f..9b22b1a56 100644 --- a/Signal/src/ViewControllers/HomeView/HomeViewController.m +++ b/Signal/src/ViewControllers/HomeView/HomeViewController.m @@ -415,7 +415,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations // The contents of the navigation bar are cramped in this view. UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; UIImage *image = [[UIImage imageNamed:@"button_settings_white"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; - button.tintColor = UIColor.ows_navbarForegroundColor; + button.tintColor = UIColor.ows_navbarIconColor; [button setImage:image forState:UIControlStateNormal]; UIEdgeInsets imageEdgeInsets = UIEdgeInsetsZero; // We normally would want to use left and right insets that ensure the button diff --git a/Signal/src/ViewControllers/MediaPageViewController.swift b/Signal/src/ViewControllers/MediaPageViewController.swift index 43c6021dd..27b15d3fe 100644 --- a/Signal/src/ViewControllers/MediaPageViewController.swift +++ b/Signal/src/ViewControllers/MediaPageViewController.swift @@ -587,7 +587,7 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou lazy private var headerNameLabel: UILabel = { let label = UILabel() - label.textColor = .ows_navbarForeground + label.textColor = .ows_navbarTitle label.font = UIFont.ows_regularFont(withSize: 17) label.textAlignment = .center label.adjustsFontSizeToFitWidth = true @@ -598,7 +598,7 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou lazy private var headerDateLabel: UILabel = { let label = UILabel() - label.textColor = .ows_navbarForeground + label.textColor = .ows_navbarTitle label.font = UIFont.ows_regularFont(withSize: 12) label.textAlignment = .center label.adjustsFontSizeToFitWidth = true diff --git a/SignalMessaging/categories/UIColor+OWS.h b/SignalMessaging/categories/UIColor+OWS.h index d7445efca..56704f16c 100644 --- a/SignalMessaging/categories/UIColor+OWS.h +++ b/SignalMessaging/categories/UIColor+OWS.h @@ -11,7 +11,8 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - Global App Colors @property (class, readonly, nonatomic) UIColor *ows_navbarBackgroundColor; -@property (class, readonly, nonatomic) UIColor *ows_navbarForegroundColor; +@property (class, readonly, nonatomic) UIColor *ows_navbarIconColor; +@property (class, readonly, nonatomic) UIColor *ows_navbarTitleColor; #pragma mark - diff --git a/SignalMessaging/categories/UIColor+OWS.m b/SignalMessaging/categories/UIColor+OWS.m index f6e5dbf18..d8447eb65 100644 --- a/SignalMessaging/categories/UIColor+OWS.m +++ b/SignalMessaging/categories/UIColor+OWS.m @@ -17,11 +17,14 @@ NS_ASSUME_NONNULL_BEGIN return UIColor.ows_whiteColor; } -+ (UIColor *)ows_navbarForegroundColor ++ (UIColor *)ows_navbarIconColor { -// return UIColor.ows_blackColor; - - return UIColor.greenColor; + return UIColor.ows_light60Color; +} + ++ (UIColor *)ows_navbarTitleColor +{ + return UIColor.ows_light90Color; } #pragma mark - diff --git a/SignalMessaging/categories/UIViewController+OWS.m b/SignalMessaging/categories/UIViewController+OWS.m index 8186b9025..143eb51ee 100644 --- a/SignalMessaging/categories/UIViewController+OWS.m +++ b/SignalMessaging/categories/UIViewController+OWS.m @@ -75,7 +75,7 @@ NS_ASSUME_NONNULL_BEGIN UIImage *backImage = [[UIImage imageNamed:(isRTL ? @"NavBarBackRTL" : @"NavBarBack")] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; OWSAssert(backImage); [backButton setImage:backImage forState:UIControlStateNormal]; - backButton.tintColor = UIColor.ows_navbarForegroundColor; + backButton.tintColor = UIColor.ows_navbarIconColor; backButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; diff --git a/SignalMessaging/utils/UIUtil.m b/SignalMessaging/utils/UIUtil.m index 24bb1adcc..57465ea87 100644 --- a/SignalMessaging/utils/UIUtil.m +++ b/SignalMessaging/utils/UIUtil.m @@ -27,11 +27,11 @@ + (void)setupSignalAppearence { UINavigationBar.appearance.barTintColor = UIColor.ows_navbarBackgroundColor; - UINavigationBar.appearance.tintColor = UIColor.ows_navbarForegroundColor; + UINavigationBar.appearance.tintColor = UIColor.ows_navbarIconColor; UIToolbar.appearance.barTintColor = UIColor.ows_navbarBackgroundColor; - UIToolbar.appearance.tintColor = UIColor.ows_navbarForegroundColor; + UIToolbar.appearance.tintColor = UIColor.ows_navbarIconColor; - UIBarButtonItem.appearance.tintColor = UIColor.ows_navbarForegroundColor; + UIBarButtonItem.appearance.tintColor = UIColor.ows_navbarIconColor; // Because our launch screen is blue, we specify the light content in our plist // but once the app has loaded we want to switch to dark. [CurrentAppContext() setStatusBarStyle:UIStatusBarStyleDefault]; @@ -43,9 +43,7 @@ [[UIToolbar appearance] setTintColor:[UIColor ows_materialBlueColor]]; // If we set NSShadowAttributeName, the NSForegroundColorAttributeName value is ignored. - UINavigationBar.appearance.titleTextAttributes = @{ - NSForegroundColorAttributeName : UIColor.ows_navbarForegroundColor - }; + UINavigationBar.appearance.titleTextAttributes = @{ NSForegroundColorAttributeName : UIColor.ows_navbarTitleColor }; } @end