Bug 1335451 - Tweak thumbnail placeholder colors and make placeholder letters uppercase. r=Gijs
authorDão Gottwald <dao@mozilla.com>
Wed, 01 Feb 2017 19:35:31 +0100
changeset 332077 133dcc512b736b76fd58dd614ce690edc310995e
parent 332076 0eb11a6b2075d63080f8f44a69859a4216080cfe
child 332078 b086788818599ff391694a4558824958588ccdbe
push id36778
push userdgottwald@mozilla.com
push dateThu, 02 Feb 2017 04:48:19 +0000
treeherderautoland@133dcc512b73 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1335451
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1335451 - Tweak thumbnail placeholder colors and make placeholder letters uppercase. r=Gijs MozReview-Commit-ID: 1s2MMPNBA5S
browser/base/content/newtab/sites.js
--- a/browser/base/content/newtab/sites.js
+++ b/browser/base/content/newtab/sites.js
@@ -253,23 +253,24 @@ Site.prototype = {
     }
     let uri = link.imageURI || PageThumbs.getThumbnailURL(this.url);
     thumbnail.style.backgroundImage = 'url("' + uri + '")';
 
     if (THUMBNAIL_PLACEHOLDER_ENABLED &&
         link.type == "history" &&
         link.baseDomain) {
       let placeholder = this._querySelector(".newtab-thumbnail.placeholder");
-      let hue = 0;
+      let charCodeSum = 0;
       for (let c of link.baseDomain) {
-        hue += c.charCodeAt(0);
+        charCodeSum += c.charCodeAt(0);
       }
-      hue %= 256;
-      placeholder.style.backgroundColor = "hsl(" + hue + ",50%,60%)";
-      placeholder.textContent = link.baseDomain.substr(0,1);
+      const COLORS = 16;
+      let hue = Math.round((charCodeSum % COLORS) / COLORS * 360);
+      placeholder.style.backgroundColor = "hsl(" + hue + ",80%,40%)";
+      placeholder.textContent = link.baseDomain.substr(0,1).toUpperCase();
     }
 
     if (link.enhancedImageURI) {
       let enhanced = this._querySelector(".enhanced-content");
       enhanced.style.backgroundImage = 'url("' + link.enhancedImageURI + '")';
 
       if (this.link.type != link.type) {
         this.node.setAttribute("type", "enhanced");