From d55cf84f718dde94ad710a1ed504085293322ba0 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Thu, 23 Jan 2020 21:12:34 -0800 Subject: [PATCH] use textColor for automatic adaptability --- shell/browser/browser_mac.mm | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/shell/browser/browser_mac.mm b/shell/browser/browser_mac.mm index 9e07b800a7557..d7721e75cb8a0 100644 --- a/shell/browser/browser_mac.mm +++ b/shell/browser/browser_mac.mm @@ -379,20 +379,16 @@ void RemoveFromLoginItems() { // Credits must be a NSAttributedString instead of NSString NSString* credits = (NSString*)options[@"Credits"]; if (credits != nil) { - // Check if app is running in dark mode - NSString* mode = [[NSUserDefaults standardUserDefaults] - stringForKey:@"AppleInterfaceStyle"]; - BOOL isDarkMode = [mode isEqualToString:@"Dark"]; - - // Set color of credits depending on if we're in dark mode or not. - NSColor* color = isDarkMode ? [NSColor whiteColor] : [NSColor blackColor]; - NSAttributedString* creditString = [[NSAttributedString alloc] - initWithString:credits - attributes:@{NSForegroundColorAttributeName : color}]; - - // Cast back to NSDictionary with updated options - NSMutableDictionary* mutable_options = [options mutableCopy]; - mutable_options[@"Credits"] = creditString; + base::scoped_nsobject mutable_options( + [options mutableCopy]); + base::scoped_nsobject creditString( + [[NSAttributedString alloc] + initWithString:credits + attributes:@{ + NSForegroundColorAttributeName : [NSColor textColor] + }]); + + [mutable_options setValue:creditString forKey:@"Credits"]; options = [NSDictionary dictionaryWithDictionary:mutable_options]; }