2020-05-08 17:49:14 +10:00
|
|
|
// Copyright © 2020 Australian Government All rights reserved.
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
|
|
|
|
extension UIColor {
|
|
|
|
static let covidHomeActiveColor = UIColor(0xC8FFB9)
|
|
|
|
static let covidHomePermissionErrorColor = UIColor(0xE2E2E2)
|
|
|
|
static let covidSafeColor = UIColor(0x00661B)
|
2020-09-14 11:23:11 +10:00
|
|
|
static let covidSafeDarkFontColor = UIColor(0x131313)
|
2020-05-15 00:47:40 -07:00
|
|
|
static let covidSafeLighterColor = UIColor(0x008A23)
|
2020-09-14 11:23:11 +10:00
|
|
|
static let covidSafeLightGreyColor = UIColor(0xDDDDDD)
|
2020-05-15 00:47:40 -07:00
|
|
|
static let covidSafeButtonDarkerColor = UIColor(0x00661B)
|
2020-06-05 10:26:40 +10:00
|
|
|
static let covidSafeErrorColor = UIColor(0xA31919)
|
2020-05-08 17:49:14 +10:00
|
|
|
|
|
|
|
var asSolidBackgroundImage: UIImage {
|
|
|
|
let rect = CGRect(x: 0, y: 0, width: 20, height: 20)
|
|
|
|
UIGraphicsBeginImageContext(rect.size)
|
|
|
|
let context = UIGraphicsGetCurrentContext()
|
|
|
|
context!.setFillColor(self.cgColor)
|
|
|
|
context!.fill(rect)
|
|
|
|
let img = UIGraphicsGetImageFromCurrentImageContext()
|
|
|
|
UIGraphicsEndImageContext()
|
|
|
|
return img!
|
|
|
|
}
|
2021-02-25 18:25:08 -08:00
|
|
|
|
|
|
|
var hexString: String {
|
|
|
|
let components = self.cgColor.components
|
|
|
|
let r: CGFloat = components?[0] ?? 0.0
|
|
|
|
let g: CGFloat = components?[1] ?? 0.0
|
|
|
|
let b: CGFloat = components?[2] ?? 0.0
|
|
|
|
|
|
|
|
let hexString = String.init(format: "#%02lX%02lX%02lX", lroundf(Float(r * 255)), lroundf(Float(g * 255)), lroundf(Float(b * 255)))
|
|
|
|
return hexString
|
|
|
|
}
|
2020-05-08 17:49:14 +10:00
|
|
|
}
|