Skip to content

Icon examples

Jan Gessinger edited this page Apr 19, 2023 · 2 revisions

It is possible to set an icon of a shortcut by passing a base64 string with the icon option. In Java it will be decoded by the BitmapFactory. The Bitmap class will only represent PNG, JPG and GIF formats (see Bitmap).

Example with FontAwesome icon

  • Visit FontAwesome and open the details page of any icon. Download the SVG locally.
  • Visit Vectr and click on Upload Image in the left sidebar.
  • Optionally you can select the path of the SVG by clicking on it and i.e. change the color of it.
  • Click on Export on the right top, choose selection in the first dropdown, choose png in the second dropdown and click download.
  • Visit PNG to Base64, choose your file, select the output format Plain text and click Encode PNG to Base64.
  • Pass the base64 output to the icon property of the plugin.
icon: {
    type: "Bitmap",
    name: "<base64-string>"
}

Example with static resource

this._httpClient.get(`assets/shortcut-icon.png`, { responseType: 'blob' }).subscribe((blob) => {
    var reader = new FileReader();
    reader.readAsDataURL(blob);
    reader.onloadend = function () {
        const iconBitmap = reader.result.toString().replace('data:image/png;base64,', '');
        // call plugin and set `icon` property
        // ...
        icon: {
            type: "Bitmap",
            name: "<base64-string>"
        }
        // ...
    };
});
Clone this wiki locally