Skip to content

Commit

Permalink
removed color extension
Browse files Browse the repository at this point in the history
  • Loading branch information
sameersyd committed Aug 26, 2020
1 parent 463a3ea commit 28c436d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
14 changes: 0 additions & 14 deletions Source/Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
16 changes: 8 additions & 8 deletions Source/MotionToastStyles/MTPale.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 28c436d

Please sign in to comment.