//
// Color.swift
//
//
// Usage
// UIColor.HexColor.Red
// UIColor.RGBColor.Red
//
import Foundation
import UIKit
extension UIColor {
convenience public init(hex: Int, alpha: CGFloat = 1.0) {
let red = CGFloat((hex & 0xFF0000) >> 16) / 255.0
let green = CGFloat((hex & 0xFF00) >> 8) / 255.0
let blue = CGFloat((hex & 0xFF)) / 255.0
self.init(red:red, green:green, blue:blue, alpha:alpha)
}
// make hex color list
public struct HexColor {
public static let Red = UIColor(hex: 0xF44336)
public static let Blue = UIColor(hex: 0x2196F3)
public static let Green = UIColor(hex: 0x4CAF50)
// etc...
}
// make rgb color list
public struct RGBColor {
public static let Red = UIColor(red: 1.0, green: 0.0, blue: 0.0, alpha: 1.0)
}
}