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

Re: NSColor <-> NSString


  • Subject: Re: NSColor <-> NSString
  • From: Alex Rice <email@hidden>
  • Date: Tue, 25 Dec 2001 00:50:04 -0700

On Monday, December 24, 2001, at 10:10 , Simson Garfinkel wrote:

Are there any standard methods or functions for converting between NSColor
and NSString?

It looks like the colorWithCatalogName: might be the appropriate function,
but I'mm not sure. The documentation doesn't make it clear if a catalog name
is reserved for the named lists of colors.

NSColorList has
-(NSColor *) colorWithKey:(NSString *) key

On page 296 of the new _Cocoa Programming for Mac OS X_ book, there is an example class ColorFormatter which as an NSFormatter converts from Strings to NSColors and vice-versa.
It has some code for converting from an arbitrary color to the nearest named color string in an NSColorList, and searching through color lists for substrings.

See ColorFormatter.m in:
http://www.bignerdranch.com/Solutions/21_Formatters/TypingTutor_21_A.tar.gz

Alex Rice <email@hidden>
Mindlube Software
http://www.mindlube.com/


  • Follow-Ups:
    • Re: NSColor <-> NSString
      • From: "Simson Garfinkel" <email@hidden>
References: 
 >NSColor <-> NSString (From: "Simson Garfinkel" <email@hidden>)

  • Prev by Date: Re: Getting internet connection.
  • Next by Date: RE: inserting non RTF graphics into an NSTextView ?
  • Previous by thread: NSColor <-> NSString
  • Next by thread: Re: NSColor <-> NSString
  • Index(es):
    • Date
    • Thread