That's because you're trying to call a class method as an instance method. It's defined as:

+ (NSColor *)colorWithCalibratedRed:(float)red green:(float)green blue:(float)blue alpha:(float)alpha;

which means you'd use it (in your example) like this:

[[NSColor colorWithCalibratedRed:5.0 green:150.0 blue:15.0 alpha:0.5] set];

One other thing to point out is that the RGBA component values have a range of 0 to 1. Any values below 0 are pinned at 0; any values above 1 are pinned at 1.


steve


On Dec 27, 2008, at 6:54 AM, Joseph Ayers wrote:

I'm trying to create a dark green color.

In
        NSColor * darkGreenColor;
        darkGreenColor = [[NSColor alloc] init];
[[darkGreenColor colorWithCalibratedRed:5.0 green:150.0 blue:15.0 alpha:0.5] set];
I get a compile warning

'NSColor' may not respond to 'colorWithCalibratedColorRed....'

What's wrong here?

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to