Adopted by: NSColorPicker
Declared in:
- AppKit/NSColorPicking.h
Together with the NSColorPickingDefault protocol, NSColorPickingCustom provides a way to add color pickers-custom user interfaces for color selection-to an application's NSColorPanel. The NSColorPickingDefault protocol provides basic behavior for a color picker. The NSColorPicker class adopts the NSColorPickingDefault protocol. The easiest way to implement a color picker is to create a subclass of NSColorPicker and implement the NSColorPickingCustom protocol for this new class.
All of NSColorPickingCustom's methods must be implemented by the custom color picker.
Here are the standard color picking modes and mode constants (defined
in AppKit/NSColorPanel.h
):
Mode | Color Mode Constant |
Grayscale-Alpha | NSGrayModeColorPanel |
Red-Green-Blue | NSRGBModeColorPanel |
Cyan-Yellow-Magenta-Black | NSCMYKModeColorPanel |
Hue-Saturation-Brightness | NSHSBModeColorPanel |
Custom palette | NSCustomPaletteModeColorPanel |
Custom color list | NSColorListModeColorPanel |
Color wheel | NSWheelModeColorPanel |
In grayscale-alpha, red-green-blue, cyan-magenta-yellow-black, and hue-saturation-brightness modes, the user adjusts colors by manipulating sliders. In the custom palette mode, the user can load an NSImage file (TIFF or EPS) into the NSColorPanel, then select colors from the image. In custom color list mode, the user can create and load lists of named colors. The two custom modes provide NSPopUpLists for loading and saving files. Finally, color wheel mode provides a simplified control for selecting colors.
If your color picker includes submodes, you should define
a unique value for each submode. As an example, the slider picker
has four values defined in the above list (NSGrayModeColorPanel
, NSRGBModeColorPanel
, NSCMYKModeColorPanel
,
and NSHSBModeColorPanel
)-one for
each of its submodes.
- Setting the Current Color
- - setColor:
- Getting the Mode
- - currentMode
- - supportsMode:
- Getting the View
- - provideNewView:
- (int)currentMode
See Also: - supportsMode:
- (NSView *)provideNewView:(BOOL)initialRequest
- (void)setColor:(NSColor
*)color
- (BOOL)supportsMode:(int)mode
See Also: - currentMode