title: Number Of Components in CGColorCreate() if colorspace is Indexed colorspace?
body: <p>I am trying to use CGColorSpaceCreateIndexed() to Create ColorRef. I want to understand rule for passing component array when we use indexed color space.</p>
  
  <pre><code>CGColorRef CGColorCreate (
     CGColorSpaceRef colorspace,
     const CGFloat components[]
  );
  </code></pre>
  
  <p>Apple doc says, The array should contain n+1 values that correspond to the n color components in the specified color space, followed by the alpha component. </p>
  
  <pre><code>unsigned char colorTable[] = {2,120,150,180,200,220,10, 30};
  CGColorSpaceRef cs = CGColorSpaceCreateIndexed(CGColorSpaceCreateDeviceCMYK(), 1, colorTable);
  </code></pre>
  
  <p>now, if I create a color using this colorspace,</p>
  
  <pre><code>const CGFloat myComponentArray[] = ??;
  CGColorRef colorref = CGColorCreate (cs, myComponentArray);
  </code></pre>
  
  <p>what should be myComponentArray? Should it depend upon the base colorspace passed in while creating indexed color space?</p>