Bug 519486 - Some themes are illegible with the text shadow implementation. r=dao
--- a/toolkit/content/LightweightThemeConsumer.jsm
+++ b/toolkit/content/LightweightThemeConsumer.jsm
@@ -71,18 +71,18 @@ LightweightThemeConsumer.prototype = {
var root = this._doc.documentElement;
var active = !!aData.headerURL;
if (active) {
root.style.color = aData.textcolor || "black";
root.style.backgroundColor = aData.accentcolor || "white";
let [r, g, b] = _parseRGB(this._doc.defaultView.getComputedStyle(root, "").color);
- let brightness = (r + g + b) / 3;
- root.setAttribute("lwthemetextcolor", brightness <= 127 ? "dark" : "bright");
+ let luminance = 0.2125 * r + 0.7154 * g + 0.0721 * b;
+ root.setAttribute("lwthemetextcolor", luminance <= 110 ? "dark" : "bright");
root.setAttribute("lwtheme", "true");
} else {
root.style.color = "";
root.style.backgroundColor = "";
root.removeAttribute("lwthemetextcolor");
root.removeAttribute("lwtheme");
}