By Opera Software

From Opera 15 onward, Opera 11 & 12’s extension format is no longer supported, and instead, we’ve switched to Chromium’s extension model. Check out our new documentation for developing extensions for Opera 15 and higher and start building your own extensions.


This property represents the Badge for the button.


You can reference and update the badge properties directly from the button object (e.g. button.badge.textContent = 42) or through the badge object.

// The background process (e.g. index.html)

// Create a button
var button = opera.contexts.toolbar.createItem({
  title:'My Extension',
  badge: {}

// Add it to the browser UI

// Set the badge and the font colors
var badge = button.badge;
badge.backgroundColor = '#5566ff';
badge.color = "#ffffff";

// Update badge properties directly through the button object
button.badge.textContent = 42;

// Get the background color?
var badgeColor = button.badge.backgroundColor; // this was set to '#5566ff' above

This article is licensed under a Creative Commons Attribution 3.0 Unported license.


No new comments accepted.