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

Color comparison


  • Subject: Color comparison
  • From: David Sinclair <email@hidden>
  • Date: Mon, 3 Jun 2002 15:08:58 -0700

I am trying to compare colors. I have colors in a text view (saved to disk as an NSAttributedString) and in an array. The former is assigned from the latter, and -IsEqual works okay until the document is saved. But after saving and reloading the colors are slightly different, so I can't simply use -IsEqual to match them. (Both colors are in NSCalibratedRGBColorSpace.)

Is there an easier way of comparing them than getting the individual color components (R, G, B) and seeing if the values are close?

NSColor's -blendedColorWithFraction:ofColor: looked promising, but not very.

Alternatively, is there any way of avoiding the difference in values. I doubt this one is feasible, as it looks like a rounding difference -- e.g. 0.0588235 vs 0.0581305.

--

David Sinclair - email@hidden
http://www.dejal.com/
_______________________________________________
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.

  • Follow-Ups:
    • Re: Color comparison
      • From: Marcel Weiher <email@hidden>
    • Re: Color comparison
      • From: "Timothy J. Wood" <email@hidden>
  • Prev by Date: Re: Real trouble: Scrolling a view
  • Next by Date: [Q] Detecting running processes
  • Previous by thread: Re: Real trouble: Scrolling a view
  • Next by thread: Re: Color comparison
  • Index(es):
    • Date
    • Thread