Commit 96238163 authored by Javier Ernesto Flores Robles's avatar Javier Ernesto Flores Robles Committed by Commit Bot

[iOS][DarkMode][MF] Support dark mode in Manual Fallback

Remove Manual Fallback specific colors and uses semantic colors.

Bug: 976671
Change-Id: Ie96cac51c86c3d4f3bd508124eed558eba5745b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1698539
Commit-Queue: Javier Ernesto Flores Robles <javierrobles@chromium.org>
Reviewed-by: default avatarRobbie Gibson <rkgibson@google.com>
Cr-Commit-Position: refs/heads/master@{#679555}
parent 80dd2aa0
......@@ -105,8 +105,6 @@ source_set("manual_fill_ui") {
"password_list_navigator.h",
"password_view_controller.h",
"password_view_controller.mm",
"uicolor_manualfill.h",
"uicolor_manualfill.mm",
]
deps = [
"//base",
......
......@@ -6,7 +6,6 @@
#import "ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_button.h"
#import "ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_utils.h"
#import "ios/chrome/browser/ui/autofill/manual_fill/uicolor_manualfill.h"
#import "ios/chrome/browser/ui/list_model/list_model.h"
#import "ios/chrome/common/ui_util/constraints_ui_util.h"
......@@ -79,8 +78,6 @@
self.action = nil;
[self.titleButton setTitle:nil forState:UIControlStateNormal];
self.titleButton.accessibilityIdentifier = nil;
[self.titleButton setTitleColor:UIColor.cr_manualFillTintColor
forState:UIControlStateNormal];
self.titleButton.enabled = YES;
self.grayLine.hidden = YES;
}
......
......@@ -5,7 +5,7 @@
#import "ios/chrome/browser/ui/autofill/manual_fill/chip_button.h"
#include "base/mac/foundation_util.h"
#import "ios/chrome/browser/ui/autofill/manual_fill/uicolor_manualfill.h"
#import "ios/chrome/common/colors/UIColor+cr_semantic_colors.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
......@@ -64,8 +64,8 @@ static const CGFloat kChipVerticalMargin = 4;
- (void)setHighlighted:(BOOL)highlighted {
[super setHighlighted:highlighted];
self.backgroundView.backgroundColor =
highlighted ? UIColor.cr_manualFillHighlightedChipColor
: UIColor.cr_manualFillChipColor;
highlighted ? UIColor.cr_systemGray3Color
: UIColor.cr_secondarySystemBackgroundColor;
}
- (void)setEnabled:(BOOL)enabled {
......@@ -84,7 +84,7 @@ static const CGFloat kChipVerticalMargin = 4;
- (void)initializeStyling {
_backgroundView = [[UIView alloc] init];
_backgroundView.userInteractionEnabled = NO;
_backgroundView.backgroundColor = UIColor.cr_manualFillChipColor;
_backgroundView.backgroundColor = UIColor.cr_secondarySystemBackgroundColor;
_backgroundView.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:_backgroundView];
......@@ -101,8 +101,7 @@ static const CGFloat kChipVerticalMargin = 4;
self.translatesAutoresizingMaskIntoConstraints = NO;
[self setTitleColor:UIColor.cr_manualFillChipDarkTextColor
forState:UIControlStateNormal];
[self setTitleColor:UIColor.cr_labelColor forState:UIControlStateNormal];
self.titleLabel.adjustsFontForContentSizeCategory = YES;
[self updateTitleLabelFont];
......
......@@ -9,6 +9,7 @@
#import "ios/chrome/browser/ui/table_view/chrome_table_view_styler.h"
#include "ios/chrome/browser/ui/util/ui_util.h"
#import "ios/chrome/browser/ui/util/uikit_ui_util.h"
#import "ios/chrome/common/colors/semantic_color_names.h"
#include "ios/chrome/grit/ios_strings.h"
#include "ui/base/l10n/l10n_util_mac.h"
......@@ -81,6 +82,8 @@ constexpr CGFloat kMinimumLoadingTime = 0.5;
[super viewDidLoad];
self.view.tintColor = [UIColor colorNamed:kTintColor];
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.sectionHeaderHeight = 0;
self.tableView.sectionFooterHeight = 20.0;
......
......@@ -6,8 +6,8 @@
#include "base/metrics/user_metrics.h"
#include "components/autofill/core/common/autofill_features.h"
#import "ios/chrome/browser/ui/autofill/manual_fill/uicolor_manualfill.h"
#include "ios/chrome/browser/ui/util/ui_util.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_strings.h"
#include "ui/base/l10n/l10n_util.h"
......@@ -262,7 +262,7 @@ static NSTimeInterval MFAnimationDuration = 0.2;
base::RecordAction(base::UserMetricsAction("ManualFallback_OpenPassword"));
[self animateKeyboardButtonHidden:NO];
[self resetTintColors];
[self.passwordButton setTintColor:UIColor.cr_manualFillTintColor];
[self.passwordButton setTintColor:[UIColor colorNamed:kTintColor]];
[self.delegate passwordButtonPressed:sender];
}
......@@ -270,7 +270,7 @@ static NSTimeInterval MFAnimationDuration = 0.2;
base::RecordAction(base::UserMetricsAction("ManualFallback_OpenCreditCard"));
[self animateKeyboardButtonHidden:NO];
[self resetTintColors];
[self.cardsButton setTintColor:UIColor.cr_manualFillTintColor];
[self.cardsButton setTintColor:[UIColor colorNamed:kTintColor]];
[self.delegate cardButtonPressed:sender];
}
......@@ -278,7 +278,7 @@ static NSTimeInterval MFAnimationDuration = 0.2;
base::RecordAction(base::UserMetricsAction("ManualFallback_OpenProfile"));
[self animateKeyboardButtonHidden:NO];
[self resetTintColors];
[self.accountButton setTintColor:UIColor.cr_manualFillTintColor];
[self.accountButton setTintColor:[UIColor colorNamed:kTintColor]];
[self.delegate accountButtonPressed:sender];
}
......
......@@ -7,7 +7,6 @@
#include "base/metrics/user_metrics.h"
#import "ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_utils.h"
#import "ios/chrome/browser/ui/autofill/manual_fill/manual_fill_content_delegate.h"
#import "ios/chrome/browser/ui/autofill/manual_fill/uicolor_manualfill.h"
#import "ios/chrome/browser/ui/list_model/list_model.h"
#import "ios/chrome/common/ui_util/constraints_ui_util.h"
......
......@@ -11,9 +11,9 @@
#import "ios/chrome/browser/ui/autofill/manual_fill/credit_card.h"
#import "ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_utils.h"
#import "ios/chrome/browser/ui/autofill/manual_fill/manual_fill_content_delegate.h"
#import "ios/chrome/browser/ui/autofill/manual_fill/uicolor_manualfill.h"
#import "ios/chrome/browser/ui/list_model/list_model.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/ui_util/constraints_ui_util.h"
#include "ios/chrome/grit/ios_strings.h"
#include "ui/base/l10n/l10n_util_mac.h"
......@@ -239,7 +239,8 @@
UILabel* expirationSeparatorLabel = CreateLabel();
expirationSeparatorLabel.font =
[UIFont preferredFontForTextStyle:UIFontTextStyleHeadline];
[expirationSeparatorLabel setTextColor:UIColor.cr_manualFillChipColor];
[expirationSeparatorLabel
setTextColor:UIColor.cr_secondarySystemBackgroundColor];
expirationSeparatorLabel.text = @"/";
[self.contentView addSubview:expirationSeparatorLabel];
AppendHorizontalConstraintsForViews(
......
......@@ -5,7 +5,7 @@
#import "ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_button.h"
#import "ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_utils.h"
#import "ios/chrome/browser/ui/autofill/manual_fill/uicolor_manualfill.h"
#import "ios/chrome/common/colors/semantic_color_names.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
......@@ -50,7 +50,7 @@ static const CGFloat kButtonVerticalMargin = 12;
#pragma mark - Private
- (void)initializeStyling {
[self setTitleColor:UIColor.cr_manualFillTintColor
[self setTitleColor:[UIColor colorNamed:kTintColor]
forState:UIControlStateNormal];
self.translatesAutoresizingMaskIntoConstraints = NO;
self.titleLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
......
......@@ -7,7 +7,7 @@
#include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h"
#import "ios/chrome/browser/ui/autofill/manual_fill/chip_button.h"
#import "ios/chrome/browser/ui/autofill/manual_fill/uicolor_manualfill.h"
#import "ios/chrome/common/colors/UIColor+cr_semantic_colors.h"
#import "ios/chrome/common/ui_util/constraints_ui_util.h"
#include "ios/chrome/grit/ios_strings.h"
#include "ui/base/l10n/l10n_util_mac.h"
......@@ -155,7 +155,7 @@ UILabel* CreateLabel() {
UIView* CreateGraySeparatorForContainer(UIView* container) {
UIView* grayLine = [[UIView alloc] init];
grayLine.backgroundColor = UIColor.cr_manualFillGrayLineColor;
grayLine.backgroundColor = UIColor.cr_systemGray5Color;
grayLine.translatesAutoresizingMaskIntoConstraints = NO;
[container addSubview:grayLine];
......
......@@ -10,8 +10,8 @@
#import "ios/chrome/browser/ui/autofill/manual_fill/credential.h"
#import "ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_utils.h"
#import "ios/chrome/browser/ui/autofill/manual_fill/manual_fill_content_delegate.h"
#import "ios/chrome/browser/ui/autofill/manual_fill/uicolor_manualfill.h"
#import "ios/chrome/browser/ui/list_model/list_model.h"
#import "ios/chrome/common/colors/UIColor+cr_semantic_colors.h"
#import "ios/chrome/common/favicon/favicon_view.h"
#import "ios/chrome/common/ui_util/constraints_ui_util.h"
#include "ios/chrome/grit/ios_strings.h"
......@@ -136,7 +136,7 @@ static const CGFloat NoMultiplier = 1.0;
[self.usernameButton setTitle:@"" forState:UIControlStateNormal];
self.usernameButton.enabled = YES;
[self.usernameButton setTitleColor:UIColor.cr_manualFillChipDarkTextColor
[self.usernameButton setTitleColor:UIColor.cr_labelColor
forState:UIControlStateNormal];
[self.passwordButton setTitle:@"" forState:UIControlStateNormal];
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_AUTOFILL_MANUAL_FILL_UICOLOR_MANUALFILL_H_
#define IOS_CHROME_BROWSER_UI_AUTOFILL_MANUAL_FILL_UICOLOR_MANUALFILL_H_
#import <UIKit/UIKit.h>
@interface UIColor (ManualFill)
// Color to set in interactable elements for manual fill (0.1, 0.45, 0.91 RGB).
@property(class, nonatomic, readonly) UIColor* cr_manualFillTintColor;
// Color for the text in manual fill chips.
@property(class, nonatomic, readonly) UIColor* cr_manualFillChipDarkTextColor;
// Color for the manual fill chips.
@property(class, nonatomic, readonly) UIColor* cr_manualFillChipColor;
// Color for the highlighted manual fill chips.
@property(class, nonatomic, readonly)
UIColor* cr_manualFillHighlightedChipColor;
// Color for the line separators in manual fill (0.66, 0.66, 0.66 RGB).
@property(class, nonatomic, readonly) UIColor* cr_manualFillSeparatorColor;
// Color for the gray line separators in manual fill.
@property(class, nonatomic, readonly) UIColor* cr_manualFillGrayLineColor;
@end
#endif // IOS_CHROME_BROWSER_UI_AUTOFILL_MANUAL_FILL_UICOLOR_MANUALFILL_H_
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/ui/autofill/manual_fill/uicolor_manualfill.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@implementation UIColor (ManualFill)
+ (UIColor*)cr_manualFillTintColor {
static UIColor* color =
[UIColor colorWithRed:0.10 green:0.45 blue:0.91 alpha:1.0];
return color;
}
+ (UIColor*)cr_manualFillChipColor {
static UIColor* color = [UIColor colorWithRed:236.0 / 255.0
green:239.0 / 255.0
blue:241.0 / 255.0
alpha:1.0];
return color;
}
+ (UIColor*)cr_manualFillHighlightedChipColor {
static UIColor* color = [UIColor colorWithRed:196.0 / 255.0
green:203.0 / 255.0
blue:207.0 / 255.0
alpha:1.0];
return color;
}
+ (UIColor*)cr_manualFillChipDarkTextColor {
static UIColor* color = [UIColor colorWithRed:55.0 / 255.0
green:55.0 / 255.0
blue:55.0 / 255.0
alpha:1.0];
return color;
}
+ (UIColor*)cr_manualFillSeparatorColor {
static UIColor* color = [UIColor colorWithRed:188.0 / 255.0
green:187.0 / 255.0
blue:193.0 / 255.0
alpha:1.0];
return color;
}
+ (UIColor*)cr_manualFillGrayLineColor {
static UIColor* color = [UIColor colorWithWhite:0.88 alpha:1.0];
return color;
}
@end
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