Commit d0c2e8dd authored by Robbie Gibson's avatar Robbie Gibson Committed by Commit Bot

[iOS][Dark Mode] Fix Sign in controller colors

Bug: 1002088
Change-Id: I0cc2e56af84400470e34d992bd1af0d6539e81d8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1793167Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Commit-Queue: Robbie Gibson <rkgibson@google.com>
Cr-Commit-Position: refs/heads/master@{#695124}
parent deda8fa5
......@@ -18,6 +18,7 @@
#import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
#import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h"
#import "ios/chrome/browser/ui/commands/application_commands.h"
#import "ios/chrome/common/colors/semantic_color_names.h"
#import "ios/chrome/common/ui_util/constraints_ui_util.h"
#include "ios/chrome/grit/ios_chromium_strings.h"
#include "ios/chrome/grit/ios_strings.h"
......@@ -94,7 +95,7 @@ BOOL gSignedInAccountsViewControllerIsShown = NO;
[super viewDidLoad];
self.styler.shouldHideSeparators = YES;
self.collectionView.backgroundColor = [UIColor clearColor];
self.collectionView.backgroundColor = UIColor.clearColor;
// Add an inset at the bottom so the user can see whether it is possible to
// scroll to see additional accounts.
......@@ -265,12 +266,12 @@ BOOL gSignedInAccountsViewControllerIsShown = NO;
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
self.view.backgroundColor = [UIColor colorNamed:kBackgroundColor];
_titleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
_titleLabel.text =
l10n_util::GetNSString(IDS_IOS_SIGNED_IN_ACCOUNTS_VIEW_TITLE);
_titleLabel.textColor = [[MDCPalette greyPalette] tint900];
_titleLabel.textColor = [UIColor colorNamed:kTextPrimaryColor];
_titleLabel.font = [MDCTypography headlineFont];
_titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:_titleLabel];
......@@ -286,7 +287,7 @@ BOOL gSignedInAccountsViewControllerIsShown = NO;
_infoLabel.text =
l10n_util::GetNSString(IDS_IOS_SIGNED_IN_ACCOUNTS_VIEW_INFO);
_infoLabel.numberOfLines = 0;
_infoLabel.textColor = [[MDCPalette greyPalette] tint700];
_infoLabel.textColor = [UIColor colorNamed:kTextSecondaryColor];
_infoLabel.font = [MDCTypography body1Font];
_infoLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:_infoLabel];
......@@ -298,12 +299,12 @@ BOOL gSignedInAccountsViewControllerIsShown = NO;
[_primaryButton
setTitle:l10n_util::GetNSString(IDS_IOS_SIGNED_IN_ACCOUNTS_VIEW_OK_BUTTON)
forState:UIControlStateNormal];
[_primaryButton setBackgroundColor:[[MDCPalette cr_bluePalette] tint500]
[_primaryButton setBackgroundColor:[UIColor colorNamed:kBlueColor]
forState:UIControlStateNormal];
[_primaryButton setTitleColor:[UIColor whiteColor]
[_primaryButton setTitleColor:[UIColor colorNamed:kSolidButtonTextColor]
forState:UIControlStateNormal];
_primaryButton.underlyingColorHint = [UIColor blackColor];
_primaryButton.inkColor = [UIColor colorWithWhite:1 alpha:0.2f];
_primaryButton.underlyingColorHint = [UIColor colorNamed:kBackgroundColor];
_primaryButton.inkColor = [UIColor colorNamed:kMDCInkColor];
_primaryButton.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:_primaryButton];
......@@ -315,12 +316,12 @@ BOOL gSignedInAccountsViewControllerIsShown = NO;
setTitle:l10n_util::GetNSString(
IDS_IOS_SIGNED_IN_ACCOUNTS_VIEW_SETTINGS_BUTTON)
forState:UIControlStateNormal];
[_secondaryButton setBackgroundColor:[UIColor whiteColor]
[_secondaryButton setBackgroundColor:UIColor.clearColor
forState:UIControlStateNormal];
[_secondaryButton setTitleColor:[[MDCPalette cr_bluePalette] tint500]
[_secondaryButton setTitleColor:[UIColor colorNamed:kBlueColor]
forState:UIControlStateNormal];
_secondaryButton.underlyingColorHint = [UIColor whiteColor];
_secondaryButton.inkColor = [UIColor colorWithWhite:0 alpha:0.06f];
_secondaryButton.underlyingColorHint = [UIColor colorNamed:kBackgroundColor];
_secondaryButton.inkColor = [UIColor colorNamed:kMDCSecondaryInkColor];
_secondaryButton.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:_secondaryButton];
......
......@@ -7,6 +7,7 @@
#include "ios/chrome/browser/ui/collection_view/cells/collection_view_cell_constants.h"
#import "ios/chrome/browser/ui/util/rtl_geometry.h"
#import "ios/chrome/browser/ui/util/uikit_ui_util.h"
#import "ios/chrome/common/colors/UIColor+cr_semantic_colors.h"
#import "ios/chrome/common/colors/semantic_color_names.h"
#import "ios/chrome/common/ui_util/constraints_ui_util.h"
#import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h"
......@@ -175,9 +176,9 @@ const CGFloat kLabelAndFieldGap = 5;
withFontScaling:(BOOL)withFontScaling {
if (cellStyle == CollectionViewCellStyle::kUIKit) {
self.textLabel.font = [UIFont systemFontOfSize:kUIKitMainFontSize];
self.textLabel.textColor = UIColorFromRGB(kUIKitMainTextColor);
self.textLabel.textColor = UIColor.cr_labelColor;
self.textField.font = [UIFont systemFontOfSize:kUIKitMainFontSize];
self.textField.textColor = [UIColor grayColor];
self.textField.textColor = UIColor.cr_secondaryLabelColor;
} else {
MaybeSetUILabelScaledFont(withFontScaling, self.textLabel,
[[MDCTypography fontLoader] mediumFontOfSize:14]);
......
......@@ -9,6 +9,8 @@
#include "ios/chrome/browser/ui/collection_view/cells/collection_view_cell_constants.h"
#import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h"
#import "ios/chrome/browser/ui/util/uikit_ui_util.h"
#import "ios/chrome/common/colors/UIColor+cr_semantic_colors.h"
#import "ios/chrome/common/colors/semantic_color_names.h"
#import "ios/third_party/material_components_ios/src/components/Palettes/src/MaterialPalettes.h"
#import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h"
#include "ui/base/l10n/l10n_util.h"
......@@ -72,11 +74,13 @@ const CGFloat kHorizontalErrorIconFixedSize = 25;
cell.detailTextLabel.text = self.detailText;
[cell cr_setAccessoryType:self.accessoryType];
if (self.shouldDisplayError) {
cell.errorIcon.image = [UIImage imageNamed:@"settings_error"];
cell.detailTextLabel.textColor = [[MDCPalette cr_redPalette] tint500];
cell.errorIcon.image = [[UIImage imageNamed:@"settings_error"]
imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
cell.errorIcon.tintColor = [UIColor colorNamed:kRedColor];
cell.detailTextLabel.textColor = [UIColor colorNamed:kRedColor];
} else {
cell.errorIcon.image = nil;
cell.detailTextLabel.textColor = [[MDCPalette greyPalette] tint500];
cell.detailTextLabel.textColor = [UIColor colorNamed:kTextPrimaryColor];
}
if (self.isEnabled) {
......@@ -154,15 +158,15 @@ const CGFloat kHorizontalErrorIconFixedSize = 25;
if (cellStyle == CollectionViewCellStyle::kUIKit) {
_textLabel.font = [UIFont systemFontOfSize:kUIKitMainFontSize];
_textLabel.textColor = UIColorFromRGB(kUIKitMainTextColor);
_textLabel.textColor = UIColor.cr_labelColor;
_detailTextLabel.font =
[UIFont systemFontOfSize:kUIKitMultilineDetailFontSize];
_detailTextLabel.textColor = UIColorFromRGB(kUIKitMultilineDetailTextColor);
_detailTextLabel.textColor = UIColor.cr_secondaryLabelColor;
} else {
_textLabel.font = [[MDCTypography fontLoader] mediumFontOfSize:14];
_textLabel.textColor = [[MDCPalette greyPalette] tint900];
_textLabel.textColor = [UIColor colorNamed:kTextPrimaryColor];
_detailTextLabel.font = [[MDCTypography fontLoader] regularFontOfSize:14];
_detailTextLabel.textColor = [[MDCPalette greyPalette] tint500];
_detailTextLabel.textColor = [UIColor colorNamed:kTextSecondaryColor];
}
}
......@@ -260,9 +264,10 @@ const CGFloat kHorizontalErrorIconFixedSize = 25;
self.imageView.image = nil;
self.textLabel.text = nil;
self.detailTextLabel.text = nil;
self.textLabel.textColor = [[MDCPalette greyPalette] tint900];
self.detailTextLabel.textColor = [[MDCPalette greyPalette] tint500];
self.textLabel.textColor = [UIColor colorNamed:kTextPrimaryColor];
self.detailTextLabel.textColor = [UIColor colorNamed:kTextSecondaryColor];
self.errorIcon.image = nil;
self.errorIcon.tintColor = nil;
self.accessoryType = MDCCollectionViewCellAccessoryNone;
self.userInteractionEnabled = YES;
self.contentView.alpha = 1;
......
......@@ -30,6 +30,7 @@ group("resources") {
":grid_theme_dark_selection_tint_color",
":grid_theme_selection_tint_color",
":mdc_ink_color",
":mdc_secondary_ink_color",
":placeholder_image_tint_color",
":red_color",
":red_dark_color",
......@@ -208,6 +209,12 @@ colorset("mdc_ink_color") {
]
}
colorset("mdc_secondary_ink_color") {
sources = [
"mdc_secondary_ink_color.colorset/Contents.json",
]
}
colorset("placeholder_image_tint_color") {
sources = [
"placeholder_image_tint_color.colorset/Contents.json",
......
{
"info" : {
"version" : 1,
"author" : "xcode"
},
"colors" : [
{
"idiom" : "universal",
"color" : {
"color-space" : "display-p3",
"components" : {
"red" : "0x00",
"alpha" : "0.06",
"blue" : "0x00",
"green" : "0x00"
}
}
},
{
"idiom" : "universal",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "display-p3",
"components" : {
"red" : "0xFF",
"alpha" : "0.06",
"blue" : "0xFF",
"green" : "0xFF"
}
}
}
]
}
......@@ -15,7 +15,11 @@ extern NSString* const kDisabledTintColor;
extern NSString* const kGridThemeSelectionTintColor;
// Background color used in the rounded squares behind favicons.
extern NSString* const kFaviconBackgroundColor;
// Ink color for an MDC button.
extern NSString* const kMDCInkColor;
// Ink color for a secondary style MDC button (button with transparent
// background).
extern NSString* const kMDCSecondaryInkColor;
// Color used to tint placeholder images and icons.
extern NSString* const kPlaceholderImageTintColor;
extern NSString* const kScrimBackgroundColor;
......
......@@ -16,6 +16,7 @@ NSString* const kGridThemeSelectionTintColor =
@"grid_theme_selection_tint_color";
NSString* const kFaviconBackgroundColor = @"favicon_background_color";
NSString* const kMDCInkColor = @"mdc_ink_color";
NSString* const kMDCSecondaryInkColor = @"mdc_secondary_ink_color";
NSString* const kPlaceholderImageTintColor = @"placeholder_image_tint_color";
NSString* const kScrimBackgroundColor = @"scrim_background_color";
NSString* const kSeparatorColor = @"separator_color";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment