What does 70% grey mean and how do I specify this in UIColor?

MikeG picture MikeG · Feb 9, 2012 · Viewed 12.8k times · Source

I'd like to replicate the default color of the UITextField placeholder field. From the documentation:

The placeholder string is drawn using a 70% grey color.

  1. What does 70% mean in this statement?
  2. What is the best way to initialize UIColor with this color, preferably in a way that shows the color is "70% grey"?

Answer

progrmr picture progrmr · Feb 9, 2012

This is 70% grey:

UIColor* grey70 = [UIColor colorWithWhite: 0.70 alpha:1];

It is white but only 70% of the maximum brightness (1.0).

1.0 is pure white, 0.5 is middle grey, 0.0 is black.