pharo-wiki icon indicating copy to clipboard operation
pharo-wiki copied to clipboard

Add icons to the system

Open jecisc opened this issue 5 years ago • 1 comments

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

jecisc avatar Jun 17 '19 10:06 jecisc

Favor usage of #binaryReadStreamDo: to ensure the resources are closed.

juliendelplanque avatar Jun 18 '19 08:06 juliendelplanque