Bug 519486 - Some themes are illegible with the text shadow implementation. r=dao
authorBlair McBride <bmcbride@mozilla.com>
Fri, 02 Oct 2009 08:22:08 +0200
changeset 33379 4270c70462b5ad3f916e13854c7067b0477fd2ed
parent 33378 2910f583aa98d99f808dbbe7d5e2282d83d4ae90
child 33380 345a62043ffc72821171e2c8b88b89bfab3c8fac
push idunknown
push userunknown
push dateunknown
reviewersdao
bugs519486
milestone1.9.3a1pre
Bug 519486 - Some themes are illegible with the text shadow implementation. r=dao
toolkit/content/LightweightThemeConsumer.jsm
--- 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");
     }