Bug 1462635 - Fix disabled text color in webext theme styled popups. r=ntim

MozReview-Commit-ID: myI1PNipvK
This commit is contained in:
Dão Gottwald
2018-05-26 18:45:06 +02:00
parent f7a83582c9
commit bca3e4e7b1
10 changed files with 61 additions and 45 deletions

View File

@@ -77,28 +77,7 @@ const ThemeVariableMap = [
lwtProperty: "popup"
}],
["--autocomplete-popup-color", {
lwtProperty: "popup_text",
processColor(rgbaChannels, element) {
const secondaryVariable = "--autocomplete-popup-secondary-color";
if (!rgbaChannels) {
element.removeAttribute("lwt-popup-brighttext");
element.style.removeProperty(secondaryVariable);
return null;
}
let {r, g, b, a} = rgbaChannels;
let luminance = 0.2125 * r + 0.7154 * g + 0.0721 * b;
if (luminance <= 110) {
element.removeAttribute("lwt-popup-brighttext");
} else {
element.setAttribute("lwt-popup-brighttext", "true");
}
element.style.setProperty(secondaryVariable, `rgba(${r}, ${g}, ${b}, 0.5)`);
return `rgba(${r}, ${g}, ${b}, ${a})`;
}
lwtProperty: "popup_text"
}],
["--autocomplete-popup-border-color", {
lwtProperty: "popup_border"