pharo-wiki
pharo-wiki copied to clipboard
Add icons to the system
We often need to manage custom icons in Pharo.
Maybe we could have a page on icons management and explain how to add our own icons.
One way to do it is to do:
ThemeIcons compile: 'myLogoContents
^ ''' , (Base64MimeConverter mimeEncode: 'logo.png' asFileReference binaryReadStream) contents , '''' classified: 'Material-Design-Lite-Core'.
ThemeIcons compile: 'myLogoIcon
^ icons
at: #''myLogoIcon''
ifAbsentPut:[ Form fromBinaryStream: self myLogoContents base64Decoded asByteArray readStream ]' classified: 'Material-Design-Lite-Core'.
Smalltalk ui icons myLogoIcon
Favor usage of #binaryReadStreamDo:
to ensure the resources are closed.