I’ve seen some people request how to do a modal color panel. Well, carbon has GetColor(..) which ultimately uses the same NSColorPanel. So, you can set it to begin a modal session before you call GetColor(..). Here’s a code snippet:
#import <Carbon/Carbon.h>
– (IBAction)buttonClick:(id)sender
{
  NSColorPanel *colorPanel = [NSColorPanel sharedColorPanel];
  NSModalSession session = [NSApp beginModalSessionForWindow:colorPanel];
  Â
  RGBColor inColor = {128, 128, 128};
  RGBColor outColor = {0, 0, 0};
  Point point = {0, 0};
  if (GetColor(point, “\pâ€, &inColor, &outColor)) {
    NSColor *color = [NSColor colorWithCalibratedRed:(float)outColor.red / (float)UINT16_MAX green:(float)outColor.green / (float)UINT16_MAX blue:(float)outColor.blue / (float)UINT16_MAX alpha:1.0];
    [colorWell setColor:color];    Â
  }
  Â
  [NSApp endModalSession:session];  Â
}
Note that the starting of modal session isn’t really required…