<commit_before>
class ColorConfig
  def initialize
    @dict = {
      'context' =>  "ECECEC",
      'project' => "DC143C",
      '@cambridgeport' => '9400D3',
      'priority' => 'FFFF00'
    }
  end

  def rgb(key)
    @dict[key] && "RGB_" + @dict[key].upcase.scan(/[A-F0-9]{2}/).join
  end

  def html(key)
    @dict[key] && "#" + @dict[key].upcase.scan(/[A-F0-9]{2}/).join
  end<commit_msg>read colors from yaml file<commit_after>require 'yaml'

class ColorConfig
  FILE = "colors.yml"

  def initialize
    @dict = {
      'context' =>  "ECECEC",
      'project' => "DC143C",
      'priority' => 'FFFF00'
    }
    if File.exist?(FILE)
      @dict.merge!(YAML::load(File.read(FILE)))
    end
  end

  def raw(key)
    s = @dict[key].to_s.sub(/^#/, '').upcase
    s.length == 3 ? (s + s) : s
  end

  def rgb(key)
    @dict[key] && "RGB_" + raw(key).scan(/[A-F0-9]{2}/).join
  end

  def html(key)
    @dict[key] && "#" + raw(key).scan(/[A-F0-9]{2}/).join
  end
{'fraction_non_alphanumeric': 0.21968911917098446, 'fraction_numerical': 0.029015544041450778, 'mean_word_length': 2.5645756457564577, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '6158045', 'n_tokens_mistral': 423, 'n_tokens_neox': 401, 'n_words': 71}