 /*
  The MIT License (MIT)
  
- © 2021 1024jp
+ © 2014-2021 1024jp
  
  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal




private extension String {
    
    subscript(range: NSRange) -> SubSequence {
        
        return self[Range(range, in: self)!]
    }
    
}

            
        case .cssRGB:
            guard
                let r = result.double(in: code, at: 1),
                let g = result.double(in: code, at: 2),
                let b = result.double(in: code, at: 3)
            else { return nil }
            self = .rgb(r / 255, g / 255, b / 255)
            
        case .cssRGBa:
            guard
                let r = result.double(in: code, at: 1),
                let g = result.double(in: code, at: 2),
                let b = result.double(in: code, at: 3),
                let a = result.double(in: code, at: 4)
            else { return nil }
            self = .rgb(r / 255, g / 255, b / 255, alpha: a)
            
        case .cssHSL:
            guard
                let h = result.double(in: code, at: 1),
                let s = result.double(in: code, at: 2),
                let l = result.double(in: code, at: 3)
            else { return nil }
            self = .hsl(h / 360, s / 100, l / 100)
            
        case .cssHSLa:
            guard
                let h = result.double(in: code, at: 1),
                let s = result.double(in: code, at: 2),
                let l = result.double(in: code, at: 3),
                let a = result.double(in: code, at: 4)
            else { return nil }
            self = .hsl(h / 360, s / 100, l / 100, alpha: a)
            
        case .cssKeyword:
            let lowercase = code.lowercased()
            guard let hex = colorKeywordMap.first(where: { $0.key.lowercased() == lowercase })?.value else {
                return nil
            }
            self.init(hex: hex)
        }
        
