From 28c436dc842c0f06e24a0614c058392d1fa194be Mon Sep 17 00:00:00 2001 From: Sameer Nawaz Date: Wed, 26 Aug 2020 22:31:35 +0530 Subject: [PATCH] removed color extension --- Source/Extension.swift | 14 -------------- Source/MotionToastStyles/MTPale.swift | 16 ++++++++-------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/Source/Extension.swift b/Source/Extension.swift index a532c39..5e9306d 100644 --- a/Source/Extension.swift +++ b/Source/Extension.swift @@ -169,17 +169,3 @@ func toastStyle_pale(message: String, toastType: ToastType, toastGravity: ToastG toastView.msgLabel.text = message return toastView } - -extension UIColor { - convenience init(hex: String, alpha: CGFloat = 1.0) { - var hexFormatted: String = hex.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines).uppercased() - if hexFormatted.hasPrefix("#") { - hexFormatted = String(hexFormatted.dropFirst()) - } - assert(hexFormatted.count == 6, "Invalid hex code used.") - var rgbValue: UInt64 = 0 - Scanner(string: hexFormatted).scanHexInt64(&rgbValue) - self.init(red: CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0, green: CGFloat((rgbValue & 0x00FF00) >> 8) / 255.0, - blue: CGFloat(rgbValue & 0x0000FF) / 255.0, alpha: alpha) - } -} diff --git a/Source/MotionToastStyles/MTPale.swift b/Source/MotionToastStyles/MTPale.swift index 1d25c8e..9fe43ac 100644 --- a/Source/MotionToastStyles/MTPale.swift +++ b/Source/MotionToastStyles/MTPale.swift @@ -53,29 +53,29 @@ class MTPale: UIView { case .success: headLabel.text = "Success" circleImg.image = loadImage(name: "success_icon_white") - sideBarView.backgroundColor = UIColor(hex: "6FCF97") - circleView.backgroundColor = UIColor(hex: "6FCF97") + sideBarView.backgroundColor = UIColor(red: 242.0, green: 201.0, blue: 76.0, alpha: 1.0) + circleView.backgroundColor = UIColor(red: 242.0, green: 201.0, blue: 76.0, alpha: 1.0) toastView.backgroundColor = loadColor(name: "alpha_green_dark") break case .error: headLabel.text = "Error" circleImg.image = loadImage(name: "error_icon_white") - sideBarView.backgroundColor = UIColor(hex: "EB5757") - circleView.backgroundColor = UIColor(hex: "EB5757") + sideBarView.backgroundColor = UIColor(red: 235.0, green: 87.0, blue: 87.0, alpha: 1.0) + circleView.backgroundColor = UIColor(red: 235.0, green: 87.0, blue: 87.0, alpha: 1.0) toastView.backgroundColor = loadColor(name: "alpha_red_dark") break case .warning: headLabel.text = "Warning" circleImg.image = loadImage(name: "warning_icon_white") - sideBarView.backgroundColor = UIColor(hex: "F2C94C") - circleView.backgroundColor = UIColor(hex: "F2C94C") + sideBarView.backgroundColor = UIColor(red: 242.0, green: 201.0, blue: 76.0, alpha: 1.0) + circleView.backgroundColor = UIColor(red: 242.0, green: 201.0, blue: 76.0, alpha: 1.0) toastView.backgroundColor = loadColor(name: "alpha_yellow_dark") break case .info: headLabel.text = "Info" circleImg.image = loadImage(name: "info_icon_white") - sideBarView.backgroundColor = UIColor(hex: "2F80ED") - circleView.backgroundColor = UIColor(hex: "2F80ED") + sideBarView.backgroundColor = UIColor(red: 47.0, green: 128.0, blue: 237.0, alpha: 1.0) + circleView.backgroundColor = UIColor(red: 47.0, green: 128.0, blue: 237.0, alpha: 1.0) toastView.backgroundColor = loadColor(name: "alpha_blue_dark") break }