What's the default color for placeholder text in UITextField?
The colour is #C7C7CD (r: 199 g:199 b: 205) (as what pterry26 said)
and the font-family is HelveticaNeue-Medium and size is 16
Note that this is a guess at what the color looks like on a screen. For the actual values, simply inspect the Apple code for attributedPlaceholder
.
You can get this colour from inspecting the attributedPlaceholder
from the UITextField
.
The default seems to be: NSColor = "UIExtendedSRGBColorSpace 0 0 0.0980392 0.22";
You could add an extension (or category) on UIColor
:
extension UIColor {
static var placeholderGray: UIColor {
return UIColor(colorLiteralRed: 0, green: 0, blue: 0.0980392, alpha: 0.22)
}
}
2018, latest syntax is just:
extension UIColor {
static var officialApplePlaceholderGray: UIColor {
return UIColor(red: 0, green: 0, blue: 0.0980392, alpha: 0.22)
}
}
#colorLiteralRed
was deprecated. Be aware of this in some cases.
I sent a screenshot to my mac and used Photoshop's eyedropper tool. For anyone interested, this is at least a very good approximation of the placeholder color on a white background:
Red: 199, Green: 199, Blue: 205