diff --git a/browser/metro/base/content/bindings/urlbar.xml b/browser/metro/base/content/bindings/urlbar.xml index fad5e76ffe2..c067f5440f3 100644 --- a/browser/metro/base/content/bindings/urlbar.xml +++ b/browser/metro/base/content/bindings/urlbar.xml @@ -734,6 +734,21 @@ item.setAttribute("label", label); item.setAttribute("value", value); item.setAttribute("iconURI", iconURI); + let xpFaviconURI = Services.io.newURI(iconURI.replace("moz-anno:favicon:",""), null, null); + Task.spawn(function() { + let colorInfo = yield ColorUtils.getForegroundAndBackgroundIconColors(xpFaviconURI); + if ( !(colorInfo && colorInfo.background && colorInfo.foreground) + || (item.getAttribute("iconURI") != iconURI) ) { + return; + } + let { background, foreground } = colorInfo; + item.style.color = foreground; //color text + item.setAttribute("customColor", background); + // when bound, use the setter to propogate the color change through the tile + if ('color' in item) { + item.color = background; + } + }).then(null, err => Components.utils.reportError(err)); } this._results.arrangeItems(); diff --git a/browser/metro/base/content/browser-scripts.js b/browser/metro/base/content/browser-scripts.js index a84095a2389..a0e1ff93316 100644 --- a/browser/metro/base/content/browser-scripts.js +++ b/browser/metro/base/content/browser-scripts.js @@ -40,6 +40,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "NewTabUtils", XPCOMUtils.defineLazyModuleGetter(this, "Promise", "resource://gre/modules/commonjs/sdk/core/promise.js"); +XPCOMUtils.defineLazyModuleGetter(this, "ColorUtils", + "resource:///modules/colorUtils.jsm"); + #ifdef NIGHTLY_BUILD XPCOMUtils.defineLazyModuleGetter(this, "ShumwayUtils", "resource://shumway/ShumwayUtils.jsm");