-
Notifications
You must be signed in to change notification settings - Fork 3
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).
- 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, chooseselection
in the first dropdown, choosepng
in the second dropdown and clickdownload
. - Visit PNG to Base64, choose your file, select the output format
Plain text
and clickEncode PNG to Base64
. - Pass the base64 output to the
icon
property of the plugin.
icon: {
type: "Bitmap",
name: "<base64-string>"
}
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>"
}
// ...
};
});