icon element

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, two 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.

<?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_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

You must be logged in to write a comment. If you're not a registered member, please sign up.