NeXT Question

by Simson L. Garfinkel

Q: Pantone colors are great, but how do I access them from my program?

Orca Starbuck

Cambridge, MA

A: NeXTSTEP 3.0 introduces a new Objective-C class called NXColorList, which NeXTSTEP uses to manage color lists. By default, NeXT-STEP only comes with one color list Pantone but you can create your own.

To access a Pantone color by number, you must first get the id of an NXColorList object associated with the list. Use:

	id	plist = [NXColorList findColorListNamed:"PANTONE"];
Then, to access color "5-3", you can use:
NXColor pcolor = [plist colorNamed:"5-3"];
To see the names of all the Pantone colors, try:
	int	i;
	for(i=0;i<[plist colorCount];i++){
		printf("color #%d is %s\n",[plist nameOfColorAt:i]);