title: How to set color of NSPopupButton Menu Item
body: <p>This is an answer, rather than a question. Searching online, I only found a really hacked, contorted answer to this question (<a href="http://www.cocoabuilder.com/archive/cocoa/58379-changing-the-text-color-of-an-nsmenuitem-in-an-nspopupbutton.html">http://www.cocoabuilder.com/archive/cocoa/58379-changing-the-text-color-of-an-nsmenuitem-in-an-nspopupbutton.html</a>), which can be answered more elegantly like so:</p>
  
  <pre><code>NSArray *itemArray = [scalePopup itemArray];
  int i;
  NSDictionary *attributes = [NSDictionary
                              dictionaryWithObjectsAndKeys:
                              [NSColor redColor], NSForegroundColorAttributeName,
                              [NSFont systemFontOfSize: [NSFont systemFontSize]],
                              NSFontAttributeName, nil];
  
  for (i = 0; i &lt; [itemArray count]; i++) {
      NSMenuItem *item = [itemArray objectAtIndex:i];
  
      NSAttributedString *as = [[NSAttributedString alloc] 
               initWithString:[item title]
               attributes:attributes];
  
      [item setAttributedTitle:as];
  }
  </code></pre>