Use transparent badge color when not in disableAll state

Works because Chrome *overlays* user-specified badge color onto its own default color.
This commit is contained in:
tophf 2015-05-21 18:39:39 +03:00
parent c60a21cf12
commit 126ec0e11d

View File

@ -16,11 +16,6 @@ function notifyAllTabs(request) {
chrome.extension.sendMessage(reqPopup); chrome.extension.sendMessage(reqPopup);
} }
var defaultBadgeColor = "red";
chrome.browserAction.getBadgeBackgroundColor({}, function(color) {
defaultBadgeColor = color;
});
function updateIcon(tab, styles) { function updateIcon(tab, styles) {
// while NTP is still loading only process the request for its main frame with a real url // while NTP is still loading only process the request for its main frame with a real url
// (but when it's loaded we should process style toggle requests from popups, for example) // (but when it's loaded we should process style toggle requests from popups, for example)
@ -61,7 +56,7 @@ function updateIcon(tab, styles) {
}); });
var t = prefs.getPref("show-badge") && styles.length ? ("" + styles.length) : ""; var t = prefs.getPref("show-badge") && styles.length ? ("" + styles.length) : "";
chrome.browserAction.setBadgeText({text: t, tabId: tab.id}); chrome.browserAction.setBadgeText({text: t, tabId: tab.id});
chrome.browserAction.setBadgeBackgroundColor({color: disableAll ? "#aaa" : defaultBadgeColor}); chrome.browserAction.setBadgeBackgroundColor({color: disableAll ? "#aaa" : [0, 0, 0, 0]});
//console.log("Tab " + tab.id + " (" + tab.url + ") badge text set to '" + t + "'."); //console.log("Tab " + tab.id + " (" + tab.url + ") badge text set to '" + t + "'.");
} }
} }