 	public var shortHexOrHexString: String {
 		return shortHexString ?? hexString
 	}
-    
-	/// SwifterSwift: Current color complementary (read-only).
-    public var complementary: UIColor {
-        let componentColors = self.cgColor.components
-        let r: CGFloat = sqrt(pow(255.0, 2.0) - pow((componentColors![0]*255), 2.0))/255
-        let g: CGFloat = sqrt(pow(255.0, 2.0) - pow((componentColors![1]*255), 2.0))/255
-        let b: CGFloat = sqrt(pow(255.0, 2.0) - pow((componentColors![2]*255), 2.0))/255
-        return UIColor(red: r, green: g, blue: b, alpha: 1.0)
-    }
+	
+	/// SwifterSwift: Get color complementary (read-only, if applicable).
+	public var complementary: UIColor? {
+		guard let components = self.cgColor.components else {
+			return nil
+		}
+		let r: CGFloat = sqrt(pow(255.0, 2.0) - pow((components[0]*255), 2.0))/255
+		let g: CGFloat = sqrt(pow(255.0, 2.0) - pow((components[1]*255), 2.0))/255
+		let b: CGFloat = sqrt(pow(255.0, 2.0) - pow((components[2]*255), 2.0))/255
+		return UIColor(red: r, green: g, blue: b, alpha: 1.0)
+	}
 	
 	/// SwifterSwift: Random color.
 	public static var random: UIColor {

		color2.getRed(&r2, green: &g2, blue: &b2, alpha: &a2)
		return UIColor(red: l1*r1 + l2*r2, green: l1*g1 + l2*g2, blue: l1*b1 + l2*b2, alpha: l1*a1 + l2*a2)
	}
    
    /// SwifterSwift: Get complementary of a UIColor
    ///
    /// - Parameters:
    ///   - color: color of which opposite color is desired
    /// - Returns: UIColor initialized from the corresponding complementary color.
    public static func getComplementary(forColor color: UIColor) -> UIColor {
        let componentColors = color.cgColor.components
        let r: CGFloat = sqrt(pow(255.0, 2.0) - pow((componentColors![0]*255), 2.0))/255
        let g: CGFloat = sqrt(pow(255.0, 2.0) - pow((componentColors![1]*255), 2.0))/255
        let b: CGFloat = sqrt(pow(255.0, 2.0) - pow((componentColors![2]*255), 2.0))/255
        return UIColor(red: r, green: g, blue: b, alpha: 1.0)
    }
	
}


			}
		}
		self.init(red: CGFloat(red) / 255.0, green: CGFloat(green) / 255.0, blue: CGFloat(blue) / 255.0, alpha: trans)
	}
	
	/// SwifterSwift: Create UIColor from a complementary of a UIColor (if applicable).
	///
	/// - Parameter color: color of which opposite color is desired.
	public convenience init?(complementaryFor color: UIColor) {
		guard let componentColors = color.cgColor.components else {
			return nil
		}
		let r: CGFloat = sqrt(pow(255.0, 2.0) - pow((componentColors[0]*255), 2.0))/255
		let g: CGFloat = sqrt(pow(255.0, 2.0) - pow((componentColors[1]*255), 2.0))/255
		let b: CGFloat = sqrt(pow(255.0, 2.0) - pow((componentColors[2]*255), 2.0))/255
		self.init(red: r, green: g, blue: b, alpha: 1.0)
	}
	
}
