Don’t use transparent = 1. That’s a carryover from the old days when only a single color could be transparent and it’s setting it to only use black. If you remove that code, it will probably work better
Here the full code without transparency. Trying to have a dark background on dark mode and full transparency of the icon on the canvas
If pic <> Nil Then
g.ClearRectangle(0, 0, g.Width, g.Height)
If Color.IsDarkMode = True then
g.DrawingColor = &c000000 //&cffffff
Else
g.DrawingColor = &cffffff
End If
g.FillRectangle(0, 0, g.Width, g.Height)
Dim p As Picture
g.DrawPicture pic, 0, 0, pic.Width / 2, pic.Height/2, 0, 0, pic.Width, pic.Height
End If
Private Function getApplicationIcon(EmailClient as String) As Picture
if SupportedEmailClients = Nil then
SupportedEmailClients = new SupportedMailApps
end if
dim BundleID as String = SupportedEmailClients.GetBundleIDForClient(EmailClient)
dim theApp as FolderItem = LaunchServicesFindApplicationForInfoMBS("", BundleID,"")
if theApp = nil then Return Nil
dim theNSImage as NSImageMBS = NSWorkspaceMBS.iconForFile(theApp)
if theNSImage = Nil then Return Nil
theNSImage.size = new NSSizeMBS(LBAccounts.RowHeight - 2 * IconOffset, LBAccounts.RowHeight - 2 * IconOffset)
dim AppImage as Picture = theNSImage.CopyPictureWithMask
Return AppImage
End Function
Seems like you’ve possibly got two problems here, the icon transparency and the background color of the canvas.
I suggest you force the canvas to fill itself with black, so you can check that your icons are working correctly. Then you can come back to the white canvas background question.
The old Transparent value only let you specify a single color to be transparent - so your icons had to have a bright green background, for example, that would turn transparent. But because it is only a single color turning transparent, icons would have sharp, jagged edges - real transparency requires feathered edges, with some pixels showing partial transparency.
The old system dates back to Mac System 8 and 9, and whatever Windows version. Newer operating systems have moved far beyond those limited graphics imaging systems.