      - parameter type:       Upon return, contains the detected color code type.
      - returns:              The color object.
      */
-    public convenience init?(colorCode: String, type: UnsafeMutablePointer<ColorCodeType>?) {
+    public convenience init?(colorCode: String, type: UnsafeMutablePointer<ColorCodeType>? = nil) {
         
         let code = colorCode.trimmingCharacters(in: .whitespacesAndNewlines)
         let codeRange = NSRange(location: 0, length: code.utf16.count)
-        var detectedCodeType: ColorCodeType = .invalid
         
         let patterns: [ColorCodeType : String] = [
-            .hex: "^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$",
-            .shortHex: "^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$",
+            .hex: "^#[0-9a-fA-F]{6}$",
+            .shortHex: "^#[0-9a-fA-F]{3}$",
             .cssRGB: "^rgb\\( *([0-9]{1,3}) *, *([0-9]{1,3}) *, *([0-9]{1,3}) *\\)$",
             .cssRGBa: "^rgba\\( *([0-9]{1,3}) *, *([0-9]{1,3}) *, *([0-9]{1,3}) *, *([0-9.]+) *\\)$",
             .cssHSL: "^hsl\\( *([0-9]{1,3}) *, *([0-9.]+)% *, *([0-9.]+)% *\\)$",

    "LightYellow": 0xFFFFE0,
    "Ivory": 0xFFFFF0,
]

        
        // create color from result
        switch detectedCodeType {
        case .hex:
            let hex = Int(String(code.characters.dropFirst()), radix: 16) ?? 0
            self.init(hex: hex)
            
        case .shortHex:
            let hex = Int(String(code.characters.dropFirst()), radix: 16) ?? 0
            let r = (hex & 0xF00) >> 8
            let g = (hex & 0x0F0) >> 4
            let b = (hex & 0x00F)
            self.init(calibratedRed: CGFloat(r) / 15, green: CGFloat(g) / 15, blue: CGFloat(b) / 15, alpha: 1.0)
            
        case .cssRGB:
            let r = Double(code.substring(with: result.rangeAt(1))) ?? 0
            let g = Double(code.substring(with: result.rangeAt(2))) ?? 0
            let b = Double(code.substring(with: result.rangeAt(3))) ?? 0
            self.init(calibratedRed: CGFloat(r) / 255, green: CGFloat(g) / 255, blue: CGFloat(b) / 255, alpha: 1.0)
            
        case .cssRGBa:
            let r = Double(code.substring(with: result.rangeAt(1))) ?? 0
            let g = Double(code.substring(with: result.rangeAt(2))) ?? 0
            let b = Double(code.substring(with: result.rangeAt(3))) ?? 0
            let a = Double(code.substring(with: result.rangeAt(4))) ?? 1
            self.init(calibratedRed: CGFloat(r) / 255, green: CGFloat(g) / 255, blue: CGFloat(b) / 255, alpha: CGFloat(a))
            
        case .cssHSL:
            let h = Double(code.substring(with: result.rangeAt(1))) ?? 0
            let s = Double(code.substring(with: result.rangeAt(2))) ?? 0
            let l = Double(code.substring(with: result.rangeAt(3))) ?? 0
            self.init(calibratedHue: CGFloat(h) / 360, saturation: CGFloat(s) / 100, lightness: CGFloat(l) / 100, alpha: 1.0)
            
        case .cssHSLa:
            let h = Double(code.substring(with: result.rangeAt(1))) ?? 0
            let s = Double(code.substring(with: result.rangeAt(2))) ?? 0
            let l = Double(code.substring(with: result.rangeAt(3))) ?? 0
            let a = Double(code.substring(with: result.rangeAt(4))) ?? 1
            self.init(calibratedHue: CGFloat(h) / 360, saturation: CGFloat(s) / 100, lightness: CGFloat(l) / 100, alpha: CGFloat(a))
            
        case .cssKeyword:
