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.