diff --git a/atom/browser/api/atom_api_system_preferences_mac.mm b/atom/browser/api/atom_api_system_preferences_mac.mm index b93abe6846645..a08c7c6b863b9 100644 --- a/atom/browser/api/atom_api_system_preferences_mac.mm +++ b/atom/browser/api/atom_api_system_preferences_mac.mm @@ -7,13 +7,13 @@ #include #import -#import #import #include "atom/browser/mac/atom_application.h" #include "atom/browser/mac/dict_util.h" #include "atom/common/native_mate_converters/gurl_converter.h" #include "atom/common/native_mate_converters/value_converter.h" +#include "base/strings/stringprintf.h" #include "base/strings/sys_string_conversions.h" #include "base/values.h" #include "native_mate/object_template_builder.h" @@ -107,12 +107,9 @@ AVMediaType ParseMediaType(const std::string& media_type) { // Convert color to RGB hex value like "#ABCDEF" std::string ToRGBHex(NSColor* color) { - NSString* rgbHex = [NSString - stringWithFormat:@"#%02X%02X%02X", (int)(color.redComponent * 0xFF), - (int)(color.greenComponent * 0xFF), - (int)(color.blueComponent * 0xFF)]; - - return std::string([rgbHex UTF8String]); + return base::StringPrintf("#%02X%02X%02X", (int)(color.redComponent * 0xFF), + (int)(color.greenComponent * 0xFF), + (int)(color.blueComponent * 0xFF)); } } // namespace diff --git a/atom/browser/mac/atom_application.h b/atom/browser/mac/atom_application.h index 2f07676e3059d..75c6db316a0a2 100644 --- a/atom/browser/mac/atom_application.h +++ b/atom/browser/mac/atom_application.h @@ -37,6 +37,27 @@ typedef NS_ENUM(NSInteger, AVAuthorizationStatusMac) { (AVMediaType)mediaType API_AVAILABLE(macosx(10.14)); @end +@interface NSColor (MojaveSDK) +@property(class, strong, readonly) + NSColor* systemBlueColor API_AVAILABLE(macosx(10.10)); +@property(class, strong, readonly) + NSColor* systemBrownColor API_AVAILABLE(macosx(10.10)); +@property(class, strong, readonly) + NSColor* systemGrayColor API_AVAILABLE(macosx(10.10)); +@property(class, strong, readonly) + NSColor* systemGreenColor API_AVAILABLE(macosx(10.10)); +@property(class, strong, readonly) + NSColor* systemOrangeColor API_AVAILABLE(macosx(10.10)); +@property(class, strong, readonly) + NSColor* systemPinkColor API_AVAILABLE(macosx(10.10)); +@property(class, strong, readonly) + NSColor* systemPurpleColor API_AVAILABLE(macosx(10.10)); +@property(class, strong, readonly) + NSColor* systemRedColor API_AVAILABLE(macosx(10.10)); +@property(class, strong, readonly) + NSColor* systemYellowColor API_AVAILABLE(macosx(10.10)); +@end + extern "C" { #if !defined(MAC_OS_X_VERSION_10_14) || \ MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_14