 //  Copyright © 2017 ZHOU DENGFENG DEREK. All rights reserved.
 //
 
-#if os(iOS)
-import UIKit
-
-public extension UIColor {
-  
-  /// Return a random color
-  static var random: UIColor {
+#if os(macOS)
+import Cocoa
+
+public extension NSColor {
+  static var random: NSColor {
     let red = (0...255).randomElement()!
     let green = (0...255).randomElement()!
     let blue = (0...255).randomElement()!
     
-    return UIColor(red: red, green: green, blue: blue)
+    return NSColor(red: red, green: green, blue: blue)
   }
   
   /// Return components of hue, saturation, brightness, and alpha

  }
}

// MARK: - Initializers

public extension UIColor {
  /// Create an UIColor object with RGB components and transparency.
  /// - Parameters:
  ///   - red: red component (between 0 and 255)
  ///   - green: green component (between 0 and 255)

    let comps = rgbaComponents
    return (red: Int(comps.red * 255.0), green: Int(comps.green * 255.0), blue: Int(comps.blue * 255.0))
  }

  var hexString: String {
    let components: [Int] = {
      let c = cgColor.components!
