<commit_before>//
//  UIButtonFactory.swift
//  shared-utils
//
//  Created by <NAME> on 2/15/16.
//  Copyright © 2016 Two Ring Software. All rights reserved.
//

import UIKit

extension UIButton {

    /**
     - description: Create a UIButton with a tintColor and an image for `.Normal` and `.Highlighted`/`.Selected` states. The images should be template rendered in the asset catalog.
     - parameters:
     - imageSetName: name of the image set in Asset catalog to use for `.Normal` state
     - emphasisSuffix: suffix to append to `imageSetName` to show for `.Highlighted` and `.Selected` states (defaults to empty string to use same image for everything)
     - tintColor: the tint color to use on the images (defaults to white)
     - target: target to receive a `touchUpInside` event
     - selector: function to call for a `touchUpInside` event
     */
    class func button(withImageSetName imageSetName: String, emphasisSuffix: String = "", tintColor: UIColor = UIColor.white, target: Any? = nil, selector: Selector? = nil) -> UIButton {
        let button = UIButton(type: .custom)
        button.tintColor = tintColor
        button.setImage(UIImage(named: "\(imageSetName)"), for: .normal)
        button.setImage(UIImage(named: "\(imageSetName)\(emphasisSuffix)"), for: .highlighted)
        button.setImage(UIImage(named: "\(imageSetName)\(emphasisSuffix)"), for: .selected)
        if selector != nil {
            button.addTarget(target, action: selector!, for: .touchUpInside)
        }
        return button
    }

    class func button(withTitle title: String, tintColor color: UIColor = .black, target: Any? = nil, selector: Selector? = nil) -> UIButton {
        let button = UIButton(type: .custom)
        button.setTitle(title, for: .normal)
        button.setTitleColor(color, for: .normal)
        if let rgb = color.rgb() {
            button.setTitleColor(UIColor(red: rgb.red, green: rgb.green, blue: rgb.blue, alpha: 0.5), for: .highlighted)
        }
        if selector != nil {<commit_msg>lighten button title in disabled state<commit_after>//
//  UIButtonFactory.swift
//  shared-utils
//
//  Created by <NAME> on 2/15/16.
//  Copyright © 2016 Two Ring Software. All rights reserved.
//

import UIKit

extension UIButton {

    /**
     - description: Create a UIButton with a tintColor and an image for `.Normal` and `.Highlighted`/`.Selected` states. The images should be template rendered in the asset catalog.
     - parameters:
     - imageSetName: name of the image set in Asset catalog to use for `.Normal` state
     - emphasisSuffix: suffix to append to `imageSetName` to show for `.Highlighted` and `.Selected` states (defaults to empty string to use same image for everything)
     - tintColor: the tint color to use on the images (defaults to white)
     - target: target to receive a `touchUpInside` event
     - selector: function to call for a `touchUpInside` event
     */
    class func button(withImageSetName imageSetName: String, emphasisSuffix: String = "", tintColor: UIColor = UIColor.white, target: Any? = nil, selector: Selector? = nil) -> UIButton {
        let button = UIButton(type: .custom)
        button.tintColor = tintColor
        button.setImage(UIImage(named: "\(imageSetName)"), for: .normal)
        button.setImage(UIImage(named: "\(imageSetName)\(emphasisSuffix)"), for: .highlighted)
        button.setImage(UIImage(named: "\(imageSetName)\(emphasisSuffix)"), for: .selected)
        if selector != nil {
            button.addTarget(target, action: selector!, for: .touchUpInside)
        }
        return button
    }

    class func button(withTitle title: String, tintColor color: UIColor = .black, target: Any? = nil, selector: Selector? = nil) -> UIButton {
        let button = UIButton(type: .custom)
        button.setTitle(title, for: .normal)
        button.setTitleColor(color, for: .normal)
        if let rgb = color.rgb() {
            let lightColor = UIColor(red: rgb.red, green: rgb.green, blue: rgb.blue, alpha: 0.5)
            button.setTitleColor(lightColor, for: .highlighted)
            button.setTitleColor(lightColor, for: .disabled)
        }
        if selector != nil {
{'fraction_non_alphanumeric': 0.11315789473684211, 'fraction_numerical': 0.005263157894736842, 'mean_word_length': 2.9630331753554504, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '6709364', 'n_tokens_mistral': 1252, 'n_tokens_neox': 1206, 'n_words': 409}