Bug 1763746 - Stop preferring dark background for SelectedItem/SelectedItemText. r=stransky

This was added because ElementaryOS themes have bright selected
backgrounds and dark text (for light themes), but we use the accent
colors for some places where that is not appropriate and a darker color
is, like checkbox backgrounds or form control borders.

Bug 1741293 split the selected item text / background colors from the
accent colors, so now we can use the real selected item colors and only
do this on the accent color. I wanted to split this out from bug 1741293
to minimize behavior changes in there.

Also while at it, blend opaque foreground with the appropriate
background on EnsureColorPairIsOpaque.

Differential Revision: https://phabricator.services.mozilla.com/D143255
This commit is contained in:
Emilio Cobos Álvarez 2022-04-08 06:51:15 +00:00
Родитель 3c00871162
Коммит 0d0ad9c7f3
1 изменённых файлов: 2 добавлений и 3 удалений

Просмотреть файл

@ -1620,7 +1620,7 @@ static void EnsureColorPairIsOpaque(nscolor& aBg, nscolor& aFg) {
// Blend with white, ensuring the color is opaque, so that the UI doesn't have // Blend with white, ensuring the color is opaque, so that the UI doesn't have
// to care about alpha. // to care about alpha.
aBg = NS_ComposeColors(NS_RGB(0xff, 0xff, 0xff), aBg); aBg = NS_ComposeColors(NS_RGB(0xff, 0xff, 0xff), aBg);
aFg = NS_ComposeColors(NS_RGB(0xff, 0xff, 0xff), aFg); aFg = NS_ComposeColors(aBg, aFg);
} }
static void PreferDarkerBackground(nscolor& aBg, nscolor& aFg) { static void PreferDarkerBackground(nscolor& aBg, nscolor& aFg) {
@ -1903,7 +1903,6 @@ void nsLookAndFeel::PerThemeData::Init() {
mSelectedItemText = mTextSelectedText; mSelectedItemText = mTextSelectedText;
} }
PreferDarkerBackground(mSelectedItem, mSelectedItemText);
EnsureColorPairIsOpaque(mSelectedItem, mSelectedItemText); EnsureColorPairIsOpaque(mSelectedItem, mSelectedItemText);
// In a similar fashion, default accent color is the selected item/text // In a similar fashion, default accent color is the selected item/text
@ -1919,8 +1918,8 @@ void nsLookAndFeel::PerThemeData::Init() {
mAccentColorForeground = mSelectedItemText; mAccentColorForeground = mSelectedItemText;
} }
PreferDarkerBackground(mAccentColor, mAccentColorForeground);
EnsureColorPairIsOpaque(mAccentColor, mAccentColorForeground); EnsureColorPairIsOpaque(mAccentColor, mAccentColorForeground);
PreferDarkerBackground(mAccentColor, mAccentColorForeground);
} }
// Button text color // Button text color