• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Trouble with NSColor
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble with NSColor


  • Subject: Re: Trouble with NSColor
  • From: "Sean McBride" <email@hidden>
  • Date: Thu, 13 Aug 2009 12:51:33 -0400
  • Organization: Rogue Research Inc.

On 8/13/09 6:24 PM, Daniel Furrer said:

>I'm trying to get the RGB components of a system color. Here's what I've
>been trying:
>
>    NSColor* foo = [[NSColor controlColor] colorUsingColorSpaceName:
>@"NSCalibratedRGBColorSpace"];
>    NSLog(@"%f, %f, %f", [foo redComponent], [foo blueComponent], [foo
>greenComponent]);
>
>but all I ever get is 0.0, 0.0, 0.0
>Also [foo numberOfComponents] seems to be 0. (For [NSColor blueColor] it's
>working fine however).
>What am I doing wrong?

Did you read the docs for 'redComponent'?

"This method works only with objects representing colors in the
NSCalibratedRGBColorSpace or NSDeviceRGBColorSpace color space"

Use colorUsingColorSpaceName:NSCalibratedRGBColorSpace to convert.

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Trouble with NSColor
      • From: Daniel Furrer <email@hidden>
References: 
 >Trouble with NSColor (From: Daniel Furrer <email@hidden>)

  • Prev by Date: Core Data Crash on MOC Release
  • Next by Date: Re: Core Data Crash on MOC Release
  • Previous by thread: Re: Trouble with NSColor
  • Next by thread: Re: Trouble with NSColor
  • Index(es):
    • Date
    • Thread