<commit_before>import UIKit

extension UIColor {
    
    class func colorFromHexString(hexString: String) -> UIColor? {
        let colorHexString = hexString.stringByReplacingOccurrencesOfString("#", withString: "", options: NSStringCompareOptions.allZeros, range: nil)
        let colorScanner = NSScanner(string: colorHexString)
        
        var value:UInt32 = 0
        
        let characters = countElements(colorHexString)
        if (characters == 6) {
            // no alpha supported
            if (colorScanner.scanHexInt(&value)) {
                let maxColorValue = UInt32(pow(Float(16), Float(6)))
                if (value < maxColorValue) {
                    let red = (CGFloat)((value & 0xFF0000) >> 16)/255.0
                    let green = (CGFloat)((value & 0xFF00) >> 8)/255.0
                    let blue = (CGFloat)(value & 0xFF)/255.0
                    return UIColor(red: red, green: green, blue: blue, alpha: 1.0)
                }
            }
        }
        
        return nil
    }
        
}<commit_msg>added method to get an image in the given color, suitable for background images<commit_after>import UIKit

extension UIColor {
    
    class func colorFromHexString(hexString: String) -> UIColor? {
        let colorHexString = hexString.stringByReplacingOccurrencesOfString("#", withString: "", options: NSStringCompareOptions.allZeros, range: nil)
        let colorScanner = NSScanner(string: colorHexString)
        
        var value:UInt32 = 0
        
        let characters = countElements(colorHexString)
        if (characters == 6) {
            // no alpha supported
            if (colorScanner.scanHexInt(&value)) {
                let maxColorValue = UInt32(pow(Float(16), Float(6)))
                if (value < maxColorValue) {
                    let red = (CGFloat)((value & 0xFF0000) >> 16)/255.0
                    let green = (CGFloat)((value & 0xFF00) >> 8)/255.0
                    let blue = (CGFloat)(value & 0xFF)/255.0
                    return UIColor(red: red, green: green, blue: blue, alpha: 1.0)
                }
            }
        }
        
        return nil
    }

    func asImage() -> UIImage {
        let rect = CGRect(x: 0, y: 0, width: 1, height: 1)
        UIGraphicsBeginImageContext(rect.size)
        let context: CGContext = UIGraphicsGetCurrentContext()
        CGContextSetFillColorWithColor(context, CGColor)
        CGContextFillRect(context, rect)
        let image: UIImage = UIGraphicsGetImageFromCurrentImageContext()
        UIGraphicsEndImageContext()
        return image
    }
        
}
{'fraction_non_alphanumeric': 0.09915449654112221, 'fraction_numerical': 0.02843966179861645, 'mean_word_length': 1.9646924829157175, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7414798', 'n_tokens_mistral': 791, 'n_tokens_neox': 731, 'n_words': 176}