From 5e581aa6dacbb5651f2858622130ca8a62f5be2d Mon Sep 17 00:00:00 2001 From: yishilin14 Date: Fri, 24 Feb 2017 21:35:49 +0800 Subject: [PATCH] Update password colors --- pass/Helpers/Globals.swift | 5 +++++ pass/Views/LabelTableViewCell.swift | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pass/Helpers/Globals.swift b/pass/Helpers/Globals.swift index a45b5c0..24f1916 100644 --- a/pass/Helpers/Globals.swift +++ b/pass/Helpers/Globals.swift @@ -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() { } } diff --git a/pass/Views/LabelTableViewCell.swift b/pass/Views/LabelTableViewCell.swift index ce079ad..3a0fd6b 100644 --- a/pass/Views/LabelTableViewCell.swift +++ b/pass/Views/LabelTableViewCell.swift @@ -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