         
         self.init(red: red.cgFloat, green: green.cgFloat, blue: blue.cgFloat, alpha: 1.0)
     }
-    
-    static func random() -> UIColor {
-        return UIColor(red: .random(), green: .random(), blue: .random(), alpha: 1.0)
+
+    convenience init(sHex: String) {
+        let hex = sHex
+        
+        var cString = hex.trimmingCharacters(in: .whitespacesAndNewlines).uppercased()
+        
+        if cString.hasPrefix("#") {
+            cString.remove(at: cString.startIndex)
+        }
+        
+        var rgbValue: UInt32 = 0
+        
+        Scanner(string: cString).scanHexInt32(&rgbValue)
+        
+        let red = CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0
+        let green = CGFloat((rgbValue & 0x00FF00) >> 8) / 255.0
+        let blue = CGFloat(rgbValue & 0x0000FF) / 255.0
+        
+        self.init(red: red, green: green, blue: blue, alpha: 1.0)
     }
-    
+
     func transparency(_ f: CGFloat) -> UIColor {
         return self.withAlphaComponent(f)
     }

        
        return color
    }
}

        var g: CGFloat = 0
        var b: CGFloat = 0
        var a: CGFloat = 0
    }
    
    
    static func random() -> UIColor {
        return UIColor(red: .random(), green: .random(), blue: .random(), alpha: 1.0)
    }
    
    var rgbaComponents: RGBAComponents {
