Clean up UIColor extensions
This commit is contained in:
parent
3059163eaa
commit
41ee7e4be6
@ -214,7 +214,7 @@ public class CLVBackupDownloadProgressView: BackupDownloadProgressView.Delegate
|
||||
icon: .backupErrorDisplayBold,
|
||||
iconSize: 40,
|
||||
tintColor: UIColor.Signal.orange,
|
||||
backgroundColor: UIColor.color(rgbHex: 0xF9E4B6),
|
||||
backgroundColor: UIColor(rgbHex: 0xF9E4B6),
|
||||
),
|
||||
title: String(
|
||||
format: OWSLocalizedString(
|
||||
|
||||
@ -5,28 +5,15 @@
|
||||
|
||||
public import UIKit
|
||||
|
||||
@objc
|
||||
public extension UIColor {
|
||||
@objc(colorWithRGBHex:)
|
||||
class func color(rgbHex: UInt32) -> UIColor {
|
||||
return UIColor(rgbHex: rgbHex)
|
||||
}
|
||||
|
||||
convenience init(rgbHex value: UInt32) {
|
||||
extension UIColor {
|
||||
public convenience init(rgbHex value: UInt32, alpha: CGFloat = 1) {
|
||||
let red = CGFloat((value >> 16) & 0xff) / 255.0
|
||||
let green = CGFloat((value >> 8) & 0xff) / 255.0
|
||||
let blue = CGFloat((value >> 0) & 0xff) / 255.0
|
||||
self.init(red: red, green: green, blue: blue, alpha: 1)
|
||||
}
|
||||
|
||||
convenience init(rgbHex value: UInt32, alpha: CGFloat) {
|
||||
let red = CGFloat((value >> 16) & 0xff) / 255.0
|
||||
let green = CGFloat((value >> 8) & 0xff) / 255.0
|
||||
let blue = CGFloat((value >> 0) & 0xff) / 255.0
|
||||
self.init(red: red, green: green, blue: blue, alpha: alpha)
|
||||
}
|
||||
|
||||
var rgbHex: UInt32 {
|
||||
public var rgbHex: UInt32 {
|
||||
var red = CGFloat.zero
|
||||
var green = CGFloat.zero
|
||||
var blue = CGFloat.zero
|
||||
@ -34,7 +21,7 @@ public extension UIColor {
|
||||
return UInt32(red * 255) << 16 | UInt32(green * 255) << 8 | UInt32(blue * 255) << 0
|
||||
}
|
||||
|
||||
convenience init(argbHex value: UInt32) {
|
||||
public convenience init(argbHex value: UInt32) {
|
||||
let alpha = CGFloat((value >> 24) & 0xff) / 255.0
|
||||
let red = CGFloat((value >> 16) & 0xff) / 255.0
|
||||
let green = CGFloat((value >> 8) & 0xff) / 255.0
|
||||
@ -42,7 +29,7 @@ public extension UIColor {
|
||||
self.init(red: red, green: green, blue: blue, alpha: alpha)
|
||||
}
|
||||
|
||||
var argbHex: UInt32 {
|
||||
public var argbHex: UInt32 {
|
||||
var alpha = CGFloat.zero
|
||||
var red = CGFloat.zero
|
||||
var green = CGFloat.zero
|
||||
@ -51,7 +38,7 @@ public extension UIColor {
|
||||
return UInt32(alpha * 255) << 24 | UInt32(red * 255) << 16 | UInt32(green * 255) << 8 | UInt32(blue * 255) << 0
|
||||
}
|
||||
|
||||
func isEqualToColor(_ color: UIColor, tolerance: CGFloat = 0) -> Bool {
|
||||
public func isEqualToColor(_ color: UIColor, tolerance: CGFloat = 0) -> Bool {
|
||||
var r1: CGFloat = 0
|
||||
var g1: CGFloat = 0
|
||||
var b1: CGFloat = 0
|
||||
|
||||
@ -92,7 +92,7 @@ class RotationControl: UIControl {
|
||||
initializeRuler()
|
||||
|
||||
// Current Value Marking
|
||||
currentValueMark.backgroundColor = UIColor.color(rgbHex: 0x62E87A)
|
||||
currentValueMark.backgroundColor = UIColor(rgbHex: 0x62E87A)
|
||||
addSubview(currentValueMark)
|
||||
currentValueMark.autoSetDimension(.width, toSize: Constants.markingWidth)
|
||||
currentValueMark.autoPinEdge(.top, to: .top, of: scrollView)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user