OS X icons size

前端 未结 6 492
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-30 09:40

What size should an application icon and menu bar icon for OS X be?

I can deal with small resolution displays but what about Retina - does an icon displayed on the men

6条回答
  •  粉色の甜心
    2021-01-30 10:05

    NSStatusBar icons (i.e. Menu bar icons) are different from regular app icons. I have not been able to find an NSStatusBar official icon guideline, but I have to believe that the Toolbar Icon guideline for buttons is pretty close. It suggests:

    • Create icons that measure no more than 19x19 pixels.
    • Make the outline sharp and clear.
    • Use a straight-on perspective.
    • Use black (add transparency only as necessary to suggest dimensionality).
    • Use anti-aliasing.
    • Use the PDF format.
    • Make sure the image is visually centered in the control (note that visually centered might not be the same as mathematically centered).

    In testing, I've found:

    1. NSStatusBar seems to look best with something 18 pixels high, or less. The systemStatusBar has a thickness of 22.
    2. While it lists PDF format, I've been using png without issue.
    3. If you want your icon to be white on blue when it's selected, you need to provide the alternateImage as a separate white version of your icon.

    Code sample:

    myStatusItem = [[NSStatusBar systemStatusBar]statusItemWithLength:NSSquareStatusItemLength];
    NSImage *statusImage = [NSImage imageNamed:@"Status.png"];
    [myStatusItem setImage:statusImage];
    NSImage *altStatusImage = [NSImage imageNamed:@"StatusHighlighted"];
    [myStatusItem setAlternateImage:altStatusImage];
    [myStatusItem setHighlightMode:YES];
    [myStatusItem setMenu:self.myStatusMenu];
    

提交回复
热议问题