Update password colors

This commit is contained in:
yishilin14 2017-02-24 21:35:49 +08:00
parent d3e02a12fa
commit 5e581aa6da
2 changed files with 7 additions and 2 deletions

View file

@ -7,6 +7,7 @@
//
import Foundation
import UIKit
class Globals {
static let documentPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0];
@ -19,5 +20,9 @@ class Globals {
static let repositoryPath = "\(documentPath)/password-store"
static var passcodeConfiguration = PasscodeLockConfiguration()
static let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as! String
static let myRedColor = UIColor(red:1.00, green:0.23, blue:0.19, alpha:1.0)
static let myBlueColor = UIColor(red:0.00, green:0.48, blue:1.00, alpha:1.0)
private init() { }
}

View file

@ -76,9 +76,9 @@ class LabelTableViewCell: UITableViewCell {
// draw all punctuation characters in the password into blue
for (index, element) in plainPassword.unicodeScalars.enumerated() {
if NSCharacterSet.decimalDigits.contains(element) {
attributePassword.addAttribute(NSForegroundColorAttributeName, value: UIColor.red , range: NSRange(location: index, length: 1))
attributePassword.addAttribute(NSForegroundColorAttributeName, value: Globals.myRedColor, range: NSRange(location: index, length: 1))
} else if NSCharacterSet.punctuationCharacters.contains(element) {
attributePassword.addAttribute(NSForegroundColorAttributeName, value: UIColor.blue , range: NSRange(location: index, length: 1))
attributePassword.addAttribute(NSForegroundColorAttributeName, value: Globals.myBlueColor, range: NSRange(location: index, length: 1))
}
}
// set contentLabel