Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(625)

Unified Diff: ui/native_theme/native_theme_mac.mm

Issue 2355433002: macviews: use system text selection color (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/native_theme/native_theme_mac.mm
diff --git a/ui/native_theme/native_theme_mac.mm b/ui/native_theme/native_theme_mac.mm
index 43e2a670ebaa36f9058564108f5a35c2be77735c..34822ac6f95055738aee5c575cce05883aa0e3cc 100644
--- a/ui/native_theme/native_theme_mac.mm
+++ b/ui/native_theme/native_theme_mac.mm
@@ -127,7 +127,7 @@ SkColor ColorToGrayscale(SkColor color) {
SkColor NativeThemeMac::GetSystemColor(ColorId color_id) const {
// Even with --secondary-ui-md, menus use the platform colors and styling, and
- // Mac has a couple of specific color overrides.
+ // Mac has a couple of specific color overrides, documented below.
switch (color_id) {
case kColorId_EnabledMenuItemForegroundColor:
return NSSystemColorToSkColor([NSColor controlTextColor]);
@@ -147,8 +147,17 @@ SkColor ColorToGrayscale(SkColor color) {
case kColorId_MenuBorderColor:
return kMenuBorderColor;
+ // Mac has a different "pressed button" styling because it doesn't use
+ // ripples.
case kColorId_ButtonPressedShade:
return SkColorSetA(SK_ColorBLACK, 0x08);
+
+ // There's a system setting General > Highlight color which sets the
+ // background color for text selections. We honor that setting.
+ // TODO(ellyjones): Listen for NSSystemColorsDidChangeNotification somewhere
+ // and propagate it to the View hierarchy.
+ case kColorId_TextfieldSelectionBackgroundFocused:
Evan Stade 2016/09/19 16:03:49 Is it not possible to change other textfield color
+ return NSSystemColorToSkColor([NSColor selectedTextBackgroundColor]);
default:
break;
}
@@ -212,8 +221,6 @@ SkColor ColorToGrayscale(SkColor color) {
return NSSystemColorToSkColor([NSColor textBackgroundColor]);
case kColorId_TextfieldSelectionColor:
return NSSystemColorToSkColor([NSColor selectedTextColor]);
- case kColorId_TextfieldSelectionBackgroundFocused:
- return NSSystemColorToSkColor([NSColor selectedTextBackgroundColor]);
// Trees/Tables. For focused text, use the alternate* versions, which
// NSColor documents as "the table and list view equivalent to the
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698