Choosing the Color Pickers in a Color Panel
The color mask determines which of the color modes are enabled for an NSColorPanel
object. This mask is set before you initialize a new instance of NSColorPanel
. NSColorPanelAllModesMask
represents the logical OR of the other color mask constants: It causes the NSColorPanel
object to display all standard color pickers. When initializing a new instance of NSColorPanel
, you can logically OR any combination of color mask constants to restrict the available color modes.
Mode | Color Mask Constant |
---|---|
Grayscale-Alpha |
|
Red-Green-Blue |
|
Cyan-Yellow-Magenta-Black |
|
Hue-Saturation-Brightness |
|
Custom palette |
|
Custom color list |
|
Color wheel |
|
All of the above |
|
The a color panel’s color mode mask is set using the class method setPickerMask:
. The mask must be set before creating an application’s instance of NSColorPanel
.
When an application’s instance of NSColorPanel
is masked for more than one color mode, your program can set its active mode by invoking the setMode:
method with a color mode constant as its argument; the user can set the mode by clicking buttons on the panel. Here are the standard color modes and mode constants:
Mode | Color Mode Constant |
---|---|
Grayscale-Alpha |
|
Red-Green-Blue |
|
Cyan-Yellow-Magenta-Black |
|
Hue-Saturation-Brightness |
|
Custom palette |
|
Custom color list |
|
Color wheel |
|
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 color panel, 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 pop-up buttons for loading and saving files. Finally, color wheel mode provides a simplified control for selecting colors.
If a color panel has been used, it uses whatever mode it was in last as the default mode when NSColorPanelAllModesMask
is used to initialize the NSColorPanel
. Otherwise, it uses color wheel mode.
Copyright © 2005, 2013 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2013-08-08