About Color Lists
NSColorList is an ordered list of
NSColor objects, identified by keys. Instances of
NSColorList, or more simply, color lists, are used to manage named lists of color objects. The list-mode color picker of an
NSColorPanel object uses instances of
NSColorList to represent any lists of colors that come with the system, as well as any lists created by the user. An application can use
NSColorList to manage document-specific color lists, which may be added to an application’s
NSColorPanel object using its
NSColorList object is similar to a dictionary object: A color object is added to, looked up in, and removed from the list by specifying its key, which is a string object. These keys are used to identify the colors in the list and are used to display the color to the user in the color panel. In addition, colors can be inserted at specified positions in the list.
The color list has a name, specified when you create the object using either the
NSColorList are created for all user-created color lists (those in the color panel) and various color catalogs available on the system.
NSColorList object saves and retrieves its colors from files with the extension “
.clr” in directories defined by a standard search path. To access all the color lists in the standard search path, use the
availableColorLists method; this returns an array of
NSColorList objects, from which you can retrieve the individual color lists by name.
The standard search path for color lists is:
The color lists returned by the
availableColorLists method include color catalogs, made up of colors defined in the
NSNamedColorSpace color space. One example is the System color list, which appears in the OS X color panel under the name “Developer.” Note, however, that not all named color lists are catalogs. In general, lists created at runtime with NSColor and NSColorList methods are not catalogs.
NSColorList reads color list files in several different formats; it saves color lists using the archiver API.
NSColorList posts an
NSColorListDidChangeNotification when a color list is changed.
© 2005, 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-03-04)