The standard OS X color picker put into an NSPopover
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Readme.md

BFColorPickerPopover

Pod Version Pod Platform Pod License Dependency Status

Screenshot

Summary

BFColorPickerPopover is a subclass of NSPopover that includes the standard OS X color picker user interface. This helps reducing the inspector window and panel clutter on the screen, as the popover sticks to the content it belongs to. However it's still possible to transform it into an inspector style floating panel by simply dragging it off from the color well.

Requirements

BFColorPickerPopover was written using ARC and Modern Objective-C. ARC (with weak references) is supported since OS X 10.7. For Modern Objective-C you'll need Xcode 4.4 or later and LLVM. I also had to use a few undocumented methods, so I can't guarantee that Apple won't reject an app with this code. They aren't that strict with OS X apps though.

Instructions

Create a Podfile, if you don't have one already. Add the following line.

pod 'BFColorPickerPopover'

Run the following command.

pod install

Alternatively, you can just drag the BFColorPickerPopover folder into your your project in Xcode. Choose "Create groups for any added folders and make sure your target is checked.

BFColorPickerPopover is a singleton class. Use [BFColorPickerPopover sharedPopover] to access it. The reason for this is, that it uses NSColorPanel to create its GUI and there is only one shared NSColorPanel available per app.

You can use the usual showRelativeToRect:ofView:preferredEdge: method of NSPopover to show the shared BFColorPickerPopover instance. But there is also a subclass of NSColorWell included (BFPopoverColorWell) that already handles presenting the popover when needed.

Check out the example application for both approaches.

License

New BSD License. For the full license text, see here.

Credits

BFColorPickerPopover was created by Balázs Faludi.