title: NSColor | Creating Color from RGB Values
body: <p>In my application, i will get RGB Values as a unsigned character so it will not be more then 255, 
  I am using NSColor API to create the color and will make use of it to draw the font and background color, </p>
  
  <p>this is the function that i have written </p>
  
  <pre><code>+(NSColor *)getColorFromRGB:(unsigned char)r blue:(unsigned char)b green:(unsigned char)g
  {
      CGFloat rFloat = r/255.0;
      CGFloat gFloat = g/255.0;
      CGFloat bFloat = b/255.0;
  
      //  return [NSColor colorWithCalibratedRed:((float)r/255.0) green:((float)g/255.0) blue:((float)b/255.0) alpha:1.0];
      return [NSColor colorWithCalibratedRed:rFloat green:gFloat blue:bFloat alpha:1.0];
  }
  </code></pre>
  
  <p>In almost all case, when i compare the Color using my RGB Value in RGB palate, color is not matching, 
  For example, when i pass , </p>
  
  <p>r = 187,
  g = 170,
  b = 170, </p>
  
  <p>It should draw the light gray, but i am getting complete whilte color, in this case, </p>
  
  <p>anyone has an idea, what i am doing wrong, </p>
  
  <p>Kind Regards</p>
  
  <p>Rohan </p>