icon element

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.

Description

If any .svg, .ico, .png, .gif or .jpg file with the name "icon" is present in the extension package (for example: 'icon.png'), then that is used as the icon for the extension by default.

The <icon> element is used to specify a custom icon file for the extension. The width and height attributes are not needed for SVG files. For bitmaps (e.g., png, gif, etc), Opera will automatically deduce the width and height of each icon.

Example

In the following example, three icon sizes are specified. The 64px icon is used in Opera's extension manager and the 18px icon (optional) is the size used for toolbar buttons. You can include icons for high density displays (for example, 'retina displays') in the same way. In the following example, the 128px icon is intended for those displays.

<?xml version="1.0" encoding="utf-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" id="http://example.com/myExtension" version="1.0">
  ...
  <icon src="images/icon_128.png"/>
  <icon src="images/icon_64.png"/>
  <icon src="images/icon_18.png"/>
  ...
</widget>

Further reading

As part of our extension documentation, we have a collection of hints and tips for creating effective extension icons.

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

Comments

No new comments accepted.