Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

browserAction.getBadgeBackgroundColor()

Gets the background color of the browser action's badge.

Syntax

chrome.browserAction.getBadgeBackgroundColor(
  details,               // object
  function(result) {...} // function
)

This API is also available as browser.browserAction.getBadgeBackgroundColor() in a version that returns a promise.

Parameters

details
object.
tabIdOptional
integer. Specifies the tab to get the badge background color from. If no tab is specified, the non-tab-specific badge background color is returned.
callback
function. The function is passed the following arguments:
result
browserAction.ColorArray. The retrieved color.

Browser compatibility

Chrome Edge Firefox Firefox for Android Opera
Basic support Yes Yes 45.0 No 33

Examples

Log the badge's background color:

function onGot(color) {
  console.log(color);
}

chrome.browserAction.getBadgeBackgroundColor({}, onGot);

Acknowledgements

This API is based on Chromium's chrome.browserAction API. This documentation is derived from browser_action.json in the Chromium code.

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

Document Tags and Contributors

 Contributors to this page: Makyen, chrisdavidmills, wbamberg
 Last updated by: Makyen,