Commit 75f1884c authored by Robbie Gibson's avatar Robbie Gibson Committed by Commit Bot

[iOS][Dark mode] Update colors on incognito NTP

See the attached bug for a screenshot.

Bug: 1002040
Change-Id: I3143aec972fe6cd172ab1de625d51c3e02159d4a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1790884Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: Robbie Gibson <rkgibson@google.com>
Cr-Commit-Position: refs/heads/master@{#694737}
parent 5e8b93b0
......@@ -113,6 +113,7 @@ source_set("ntp_internal") {
"//ios/chrome/browser/web_state_list",
"//ios/chrome/common",
"//ios/chrome/common/app_group",
"//ios/chrome/common/colors",
"//ios/chrome/common/favicon",
"//ios/chrome/common/ntp_tile",
"//ios/chrome/common/ui_util",
......
......@@ -14,6 +14,8 @@
#import "ios/chrome/browser/ui/util/uikit_ui_util.h"
#import "ios/chrome/browser/url_loading/url_loading_params.h"
#import "ios/chrome/browser/url_loading/url_loading_service.h"
#import "ios/chrome/common/colors/dynamic_color_util.h"
#import "ios/chrome/common/colors/semantic_color_names.h"
#import "ios/chrome/common/string_util.h"
#import "ios/chrome/common/ui_util/constraints_ui_util.h"
#import "ios/third_party/material_components_ios/src/components/Buttons/src/MaterialButtons.h"
......@@ -38,8 +40,6 @@ const CGFloat kStackViewImageSpacing = 22.0;
const CGFloat kLayoutGuideVerticalMargin = 8.0;
const CGFloat kLayoutGuideMinHeight = 12.0;
const int kLinkColor = 0x3A8FFF;
// The URL for the the Learn More page shown on incognito new tab.
// Taken from ntp_resource_cache.cc.
const char kLearnMoreIncognitoUrl[] =
......@@ -59,7 +59,9 @@ UIFont* TitleFont() {
// Returns the color to use for body text.
UIColor* BodyTextColor() {
return [UIColor colorWithWhite:1.0 alpha:0.7];
return color::DarkModeDynamicColor(
[UIColor colorNamed:kTextSecondaryColor], true,
[UIColor colorNamed:kTextSecondaryDarkColor]);
}
// Returns a font, scaled to the current dynamic type settings, that is suitable
......@@ -167,11 +169,16 @@ NSAttributedString* FormatHTMLListForUILabel(NSString* listString) {
[_containerView addSubview:_stackView];
// Incognito image.
UIImageView* incognitoImage = [[UIImageView alloc]
initWithImage:[UIImage imageNamed:@"incognito_icon"]];
[_stackView addArrangedSubview:incognitoImage];
UIImage* incognitoImage = [[UIImage imageNamed:@"incognito_icon"]
imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
UIImageView* incognitoImageView =
[[UIImageView alloc] initWithImage:incognitoImage];
incognitoImageView.tintColor = color::DarkModeDynamicColor(
[UIColor colorNamed:kTextPrimaryColor], true,
[UIColor colorNamed:kTextPrimaryDarkColor]);
[_stackView addArrangedSubview:incognitoImageView];
[_stackView setCustomSpacing:kStackViewImageSpacing
afterView:incognitoImage];
afterView:incognitoImageView];
[self addTextSections];
......@@ -355,9 +362,13 @@ NSAttributedString* FormatHTMLListForUILabel(NSString* listString) {
// Adds views containing the text of the incognito page to |_stackView|.
- (void)addTextSections {
UIColor* titleTextColor = [UIColor whiteColor];
UIColor* titleTextColor =
color::DarkModeDynamicColor([UIColor colorNamed:kTextPrimaryColor], true,
[UIColor colorNamed:kTextPrimaryDarkColor]);
UIColor* bodyTextColor = BodyTextColor();
UIColor* linkTextColor = UIColorFromRGB(kLinkColor);
UIColor* linkTextColor =
color::DarkModeDynamicColor([UIColor colorNamed:kBlueColor], true,
[UIColor colorNamed:kBlueDarkColor]);
// Title.
UILabel* titleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
......
......@@ -11,6 +11,8 @@
#import "ios/chrome/browser/ui/ntp/incognito_view.h"
#import "ios/chrome/browser/ui/util/uikit_ui_util.h"
#import "ios/chrome/browser/url_loading/url_loading_service.h"
#import "ios/chrome/common/colors/dynamic_color_util.h"
#import "ios/chrome/common/colors/semantic_color_names.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
......@@ -35,13 +37,19 @@
}
- (void)viewDidLoad {
if (@available(iOS 13, *)) {
self.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;
}
self.incognitoView = [[IncognitoView alloc] initWithFrame:self.view.bounds
urlLoadingService:_urlLoadingService];
[self.incognitoView setAutoresizingMask:UIViewAutoresizingFlexibleHeight |
UIViewAutoresizingFlexibleWidth];
[self.incognitoView
setBackgroundColor:[UIColor colorWithWhite:34 / 255.0 alpha:1.0]];
UIColor* backgroundColor =
color::DarkModeDynamicColor([UIColor colorNamed:kBackgroundColor], true,
[UIColor colorNamed:kBackgroundDarkColor]);
self.incognitoView.backgroundColor = backgroundColor;
[self.view addSubview:self.incognitoView];
}
......
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