Bug 1929460 - Use .labelColor for caption and dialog/window colors. r=mac-reviewers,spohl

As per [1], this is probably a better generic color, specially when atop
translucent effects / NSVisualEffectView:

> Instead of defining custom grayscale color assets, consider using the
> built-in colors labelColor, secondaryLabelColor, tertiaryLabelColor,
> and quaternaryLabelColor. While typically used with text, these colors
> are applicable with any app content. The built-in colors represent
> varying levels of contrast for your content, with labelColor offering
> the most contrast, and quaternaryLabelColor offering the least
> contrast.

In practical terms for default configurations, it means that the default
light mode color becomes semi-transparent (0, 0, 0, .87) in Sonoma,
which looks a bit less harsh against white backgrounds, which UX brought
up over Slack. In dark mode colors are the same.

I've also verified this looks good with increase-contrast mode etc.

[1]: https://developer.apple.com/documentation/appkit/nsvisualeffectview#1674177

Differential Revision: https://phabricator.services.mozilla.com/D228115
This commit is contained in:
Emilio Cobos Álvarez
2024-11-07 18:02:19 +00:00
parent 1b8c9b9ab5
commit 20d29d0f6a

View File

@@ -225,10 +225,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
? GetColorFromNSColor(NSColor.controlTextColor) ? GetColorFromNSColor(NSColor.controlTextColor)
: NS_RGB(0xFF, 0xFF, 0xFF); : NS_RGB(0xFF, 0xFF, 0xFF);
break; break;
case ColorID::Windowtext:
case ColorID::MozDialogtext:
aColor = GetColorFromNSColor(NSColor.windowFrameTextColor);
break;
case ColorID::Appworkspace: case ColorID::Appworkspace:
aColor = NS_RGB(0xFF, 0xFF, 0xFF); aColor = NS_RGB(0xFF, 0xFF, 0xFF);
break; break;
@@ -344,7 +340,9 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
case ColorID::MozHeaderbarinactivetext: case ColorID::MozHeaderbarinactivetext:
case ColorID::Inactivecaptiontext: case ColorID::Inactivecaptiontext:
case ColorID::Captiontext: case ColorID::Captiontext:
aColor = GetColorFromNSColor(NSColor.textColor); case ColorID::Windowtext:
case ColorID::MozDialogtext:
aColor = GetColorFromNSColor(NSColor.labelColor);
return NS_OK; return NS_OK;
case ColorID::MozHeaderbar: case ColorID::MozHeaderbar:
case ColorID::MozHeaderbarinactive: case ColorID::MozHeaderbarinactive: