Re: Status bar item icon is always black
Re: Status bar item icon is always black
- Subject: Re: Status bar item icon is always black
- From: Uli Kusterer via Cocoa-dev <email@hidden>
- Date: Thu, 18 Jun 2020 03:07:48 +0200
Yeah, the isTemplate definitely shouldn't be set, that would cause that issue,
I'd have expected setting that to false to fix your issue.
I also think there was a feature where NSImage would automatically set the
template flag when an image's name ended in "Template" or something like that.
You might want to search for that unless you're really using an image named
"AppIcon".
I'd also check if the asset catalog has any settings that sound like they make
it a template and turn those off. Maybe something related to light/dark mode
variants?
I just checked, and Flexibits' Fantastical still can use a colored icon, so
there must be a way to make it work.
Is your status bar item a menu, or does it behave like a button? Fantastical
does the latter, so maybe if you ask for a menu, you get some default "menu
title" themeing?
> On 17. Jun 2020, at 20:17, Gabriel Zachmann via Cocoa-dev
> <email@hidden> wrote:
>
> I am trying to define an icon for a very simple status bar menu item.
> My problem is that it appears always as black, or not at all, or grey-ish,
> depending on what I have tried, but not as intended.
>
> I have populated the asset catalog with icon images of all the required sizes
> that work fine in another , regular app. No luck.
> I have populated the asset catalog with just one icon that I downloaded from
> here
>
> https://koenig-media.raywenderlich.com/uploads/2015/03/email@hidden
> which is supposed to work.
> I still just get a black rectangle in the status bar.
>
> (The status bar app works, btw.)
>
> Ideally, I'd like my icon for my status bar app be in color.
>
> Here is the code:
>
> let statusBar = NSStatusBar.system
> statusBarItem_ = statusBar.statusItem( withLength:
> NSStatusItem.squareLength )
> // statusBarItem_.button?.title = "AAL"
> let itemImage = NSImage(named: "AppIcon")
> itemImage?.isTemplate = true
> statusBarItem_.button?.image = itemImage
>
> I have tried it with and without isTemplate = true.
>
>
> Could anyone please give me a hint what I can try?
> Thanks a lot in advance.
>
> Best, G.
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden