mirror of
https://github.com/wahyd4/libr-ios.git
synced 2026-08-09 05:06:46 +10:00
22 lines
519 B
Swift
22 lines
519 B
Swift
//
|
|
// UIColorExtension.swift
|
|
// librx
|
|
//
|
|
// Created by Yunlong Zheng on 15/9/19.
|
|
// Copyright (c) 2015年 librx. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
extension UIColor {
|
|
convenience init(rgb: Int, alpha: CGFloat) {
|
|
let r = CGFloat((rgb & 0xFF0000) >> 16)/255
|
|
let g = CGFloat((rgb & 0xFF00) >> 8)/255
|
|
let b = CGFloat(rgb & 0xFF)/255
|
|
self.init(red: r, green: g, blue: b, alpha: alpha)
|
|
}
|
|
|
|
convenience init(rgb: Int) {
|
|
self.init(rgb:rgb, alpha:1.0)
|
|
}
|
|
} |