In most programming languages, such as .NET or Java, if you wanted to create a Color object from an RGB, you would execute some method on a Color class passing in Red, Green and Blue values where these values are typically within the range 0 through 255.
If you want to do perform a similar operation in Cocoa, i.e. creating a NSColor object, you need to pass in color values within the range 0 through 1.
Typically, to create a NSColor object in Cocoa, you would use a method such as
[NSColor colorWithDeviceRed: green: blue: alpha:]
To convert RGB values into the appropriate values for this method, you need to add 1 to each separate RGB value and then divide by 256.
So, for example, Alice Blue with an RGB of (240, 248, 255) could be instantiated as a NSColor using the values:
Red: (240+1)/256 = 0.941
Green: (248+1)/256 = 0.973
Blue: (255+1)/256 = 1.0
[NSColor colorWithDeviceRed:0.941 green:0.973 blue:1.0 alpha:1.0] 
I’ve spent the last hour or so trying to track down a problem with a multi-threaded GUI Cocoa application that I’ve written.
The problem turned out to be that I was trying to update the applications UI from a background thread. In Cocoa apps, you should only really be updating the applications UI from within the main thread. If you don’t, you get strange results such as the app working in debug and not release or sometimes even hanging altogether.
I fixed the problem by updating the GUI from the background thread by using the performSelectorOnMainThread method. Something similar to below.
-(void)backgroundThread { 
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
// .. Update main UI.
[self performSelectorOnMainThread: @selector(updateGui withObject:results waitUntilDone:NO];
// ..
[pool drain];
-(void)updateGui:(NSString*) results {
// Update the gui.