Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There's no such thing as a "pure" RGB color that's consistent from one display to the next. Unless you're working in a standardized color space, the numbers that show up for a color on one display will probably render slightly differently on another.</p> <p>Have your designer convert your mock-ups to a standard color space such as sRGB. Then you can use the methods on NSColor that take not just component values but the color space the components are in; this will get you colors that should look similar on any display.</p> <p>In other words, a color swatch made from (R, G, B) = (1.0, 1.0, 1.0) in Photoshop using sRGB should look virtually identical to a color swatch drawn using a color you get this way:</p> <pre><code>NSColorSpace *sRGB = [NSColorSpace sRGBColorSpace]; CGFloat components[3] = { 1.0, 1.0, 1.0 }; NSColor *sRGBRed = [NSColor colorWithColorSpace:sRGB components:&amp;components count:3]; </code></pre> <p>Note though that <code>+[NSColorSpace sRGBColorSpace]</code> is only available on Mac OS X 10.5 Leopard and above. If you still need to run on Tiger, you could write a little utility app that runs on 10.5 and converts the canonical sRGB colors to the calibrated RGB space:</p> <pre><code>NSColor *calibratedColor = [sRGBRed colorUsingColorSpaceName:NSCalibratedRGBColorSpace]; </code></pre> <p>Regardless of whether you use sRGB or the calibrated space, once you have a set of colors, you could put them in an NSColorList that you write to a file and then load from your application's resources at runtime.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload