Bug 1379266 - Tweak -moz-win-accentcolortext formula to better match native title bars. r?jimm
MozReview-Commit-ID: 9unrhFI3sWh
--- a/widget/windows/nsLookAndFeel.cpp
+++ b/widget/windows/nsLookAndFeel.cpp
@@ -821,16 +821,16 @@ nsLookAndFeel::GetAccentColorText(nscolo
// We want the color that we return for text that will be drawn over
// a background that has the accent color to have good contrast with
// the accent color. Windows itself uses either white or black text
// depending on how light or dark the accent color is. We do the same
// here based on the luminance of the accent color with a threshhold
// value that seem consistent with what Windows does.
- float luminance = 0.2125f * NS_GET_R(accentColor) +
- 0.7154f * NS_GET_G(accentColor) +
- 0.0721f * NS_GET_B(accentColor);
+ float luminance = (NS_GET_R(accentColor) * 2 +
+ NS_GET_G(accentColor) * 5 +
+ NS_GET_B(accentColor)) / 8;
- aColor = (luminance <= 110) ? NS_RGB(255, 255, 255) : NS_RGB(0, 0, 0);
+ aColor = (luminance <= 128) ? NS_RGB(255, 255, 255) : NS_RGB(0, 0, 0);
return NS_OK;
}