• 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: color
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: color


  • Subject: Re: color
  • From: "Alastair J.Houghton" <email@hidden>
  • Date: Thu, 29 May 2003 23:45:46 +0100

On Thursday, May 29, 2003, at 11:32 pm, Andreas Mayer wrote:

> Am Freitag, 30.05.03 um 00:11 Uhr schrieb Rhon Fitzwater:
>
>> Right now I have this as my code: [NSColor cyanColor] but that color
>> is noticably different than what I want.
>
> Cyan is #00FFFF.
>
>> If someone can help me with
>> the code that would be great.
>
> [NSColor colorWithCalibratedRed:(0x33/0xFF) green:(0xCC/0xFF)
> blue:(0xFF/0xFF) alpha:1.0];
>
> should do it.

Almost. The divisions in the above solution are integer division, which
is wrong (you'll get blue, I think, if you try the code above). Replace
all of the n/0xFF expressions with n/255.0 and it should work.

i.e. it should be

[NSColor colorWithCalibratedRed: 0x33/255.0
green: 0xCC/255.0
blue: 0xFF/255.0
alpha: 1.0]

Kind regards,

Alastair.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: color (From: Andreas Mayer <email@hidden>)

  • Prev by Date: Re: color
  • Next by Date: Re: color
  • Previous by thread: Re: color
  • Next by thread: Re: color
  • Index(es):
    • Date
    • Thread