Bug 1710643 - Use an slightly higher threshold to consider a color dark. r=Gijs

Luminance goes from 0 to 255, so using 127 makes sense, and allows all
disabled titlebar colors that I found in various GTK themes to still be
considered dark enough (for those, 110 was too low).

Differential Revision: https://phabricator.services.mozilla.com/D114876
This commit is contained in:
Emilio Cobos Álvarez 2021-05-12 22:52:28 +00:00
Родитель 9de60477e2
Коммит 3c48e4f525
3 изменённых файлов: 4 добавлений и 3 удалений

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

@ -8783,8 +8783,9 @@ var ToolbarIconColor = {
luminances.set(toolbar, luminance);
}
const luminanceThreshold = 127; // In between 0 and 255
for (let [toolbar, luminance] of luminances) {
if (luminance <= 110) {
if (luminance <= luminanceThreshold) {
toolbar.removeAttribute("brighttext");
} else {
toolbar.setAttribute("brighttext", "true");

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

@ -194,5 +194,5 @@ const ThemeContentPropertyList = [
// This is copied from LightweightThemeConsumer.jsm.
function _isColorDark(r, g, b) {
return 0.2125 * r + 0.7154 * g + 0.0721 * b <= 110;
return 0.2125 * r + 0.7154 * g + 0.0721 * b <= 127;
}

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

@ -480,5 +480,5 @@ function _rgbaToString(parsedColor) {
// There is a second copy of this in ThemeVariableMap.jsm.
function _isColorDark(r, g, b) {
return 0.2125 * r + 0.7154 * g + 0.0721 * b <= 110;
return 0.2125 * r + 0.7154 * g + 0.0721 * b <= 127;
}