<commit_before>//
//  IssueLabelCell.swift
//  Freetime
//
//  Created by <NAME> on 5/20/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import UIKit
import IGListKit
import SnapKit

final class IssueLabelCell: UICollectionViewCell {

    let background = UIView()
    let label = UILabel()

    override init(frame: CGRect) {
        super.init(frame: frame)

        background.layer.cornerRadius = Styles.Sizes.avatarCornerRadius
        contentView.addSubview(background)
        background.snp.makeConstraints { make in
            make.left.equalTo(Styles.Sizes.gutter)
            make.right.equalTo(-Styles.Sizes.gutter)
            make.top.equalTo(0)
            make.bottom.equalTo(-Styles.Sizes.rowSpacing)
        }

        label.font = UIFont.boldSystemFont(ofSize: 12.0)
        background.addSubview(label)
        label.snp.makeConstraints { make in
            make.centerY.equalTo(background)
            make.left.equalTo(Styles.Sizes.columnSpacing)
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}

extension IssueLabelCell: IGListBindable {

    func bindViewModel(_ viewModel: Any) {
        guard let viewModel = viewModel as? Label else { return }
        background.backgroundColor = UIColor.fromHex(viewModel.color)
        label.text = viewModel.name
    }

}<commit_msg>text color based on bg<commit_after>//
//  IssueLabelCell.swift
//  Freetime
//
//  Created by <NAME> on 5/20/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import UIKit
import IGListKit
import SnapKit

final class IssueLabelCell: UICollectionViewCell {

    let background = UIView()
    let label = UILabel()

    override init(frame: CGRect) {
        super.init(frame: frame)

        background.layer.cornerRadius = Styles.Sizes.avatarCornerRadius
        contentView.addSubview(background)
        background.snp.makeConstraints { make in
            make.left.equalTo(Styles.Sizes.gutter)
            make.right.equalTo(-Styles.Sizes.gutter)
            make.top.equalTo(0)
            make.bottom.equalTo(-Styles.Sizes.rowSpacing)
        }

        label.font = UIFont.boldSystemFont(ofSize: 12.0)
        background.addSubview(label)
        label.snp.makeConstraints { make in
            make.centerY.equalTo(background)
            make.left.equalTo(Styles.Sizes.columnSpacing)
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}

extension IssueLabelCell: IGListBindable {

    func bindViewModel(_ viewModel: Any) {
        guard let viewModel = viewModel as? Label else { return }
        let color = UIColor.fromHex(viewModel.color)
        background.backgroundColor = color
        label.text = viewModel.name
        label.textColor = color.textOverlayColor
    }

}
{'fraction_non_alphanumeric': 0.0984060984060984, 'fraction_numerical': 0.009009009009009009, 'mean_word_length': 2.4533492822966507, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3379647', 'n_tokens_mistral': 897, 'n_tokens_neox': 880, 'n_words': 175}