<commit_before>export default class Color {
  static styleToRGBA(value) {
    document.head.style.color = value;

    const results = /rgba?\s*\(\s*(\d*),\s*(\d*)\s*,\s*(\d*)\s*(,\s*([\.\d]*))?\s*\)/.exec(getComputedStyle(document.head).getPropertyValue("color"));
    return results ? [
      parseInt(results[1]) / 255,
      parseInt(results[2]) / 255,
      parseInt(results[3]) / 255,
      results[5] !== undefined ? parseFloat(results[5]) : 1,
    ] : null;
  }

  static RGBToHSL(rgb, output = []) {
    const r = rgb[0];
    const g = rgb[1];
    const b = rgb[2];

    const max = Math.max(r, g, b);
    const min = Math.min(r, g, b);

    let hue;
    let saturation;

    const lightness = (min + max) / 2.0;

    if (min === max) {
      hue = 0;
      saturation = 0;
    } else {
      let delta = max - min;
      saturation = lightness <= 0.5 ? delta / (max + min) : delta / (2 - max - min);
      switch (max) {
        case r: hue = (g - b) / delta + (g < b ? 6 : 0); break;
        case g: hue = (b - r) / delta + 2; break;
        case b: hue = (r - g) / delta + 4; break;
      }
      hue /= 6;
    }

    output[0] = hue;
    output[1] = saturation;
    output[2] = lightness;

    return output;
  }

  static hexToRGB(hex) {
    let results = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
    return results ? [
      parseInt(results[1], 16) / 255,
      parseInt(results[2], 16) / 255,
      parseInt(results[3], 16) / 255,
    ] : null;
  }
}<commit_msg>clean<commit_after>export default class Color {
  static styleToRGBA(value) {
    document.head.style.color = value;

    const results = /rgba?\s*\(\s*(\d*),\s*(\d*)\s*,\s*(\d*)\s*(,\s*([.\d]*))?\s*\)/.exec(getComputedStyle(document.head).getPropertyValue("color"));
    return results ? [
      parseInt(results[1]) / 255,
      parseInt(results[2]) / 255,
      parseInt(results[3]) / 255,
      results[5] !== undefined ? parseFloat(results[5]) : 1,
    ] : null;
  }

  static RGBToHSL(rgb, output = []) {
    const r = rgb[0];
    const g = rgb[1];
    const b = rgb[2];

    const max = Math.max(r, g, b);
    const min = Math.min(r, g, b);

    let hue;
    let saturation;

    const lightness = (min + max) / 2.0;

    if (min === max) {
      hue = 0;
      saturation = 0;
    } else {
      const delta = max - min;
      saturation = lightness <= 0.5 ? delta / (max + min) : delta / (2 - max - min);
      switch (max) {
        case r: hue = (g - b) / delta + (g < b ? 6 : 0); break;
        case g: hue = (b - r) / delta + 2; break;
        case b: hue = (r - g) / delta + 4; break;
      }
      hue /= 6;
    }

    output[0] = hue;
    output[1] = saturation;
    output[2] = lightness;

    return output;
  }

  static hexToRGB(hex) {
    const results = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
    return results ? [
      parseInt(results[1], 16) / 255,
      parseInt(results[2], 16) / 255,
      parseInt(results[3], 16) / 255,
    ] : null;
  }
}
{'fraction_non_alphanumeric': 0.20308828465928164, 'fraction_numerical': 0.03625377643504532, 'mean_word_length': 2.091286307053942, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '1621712', 'n_tokens_mistral': 1236, 'n_tokens_neox': 1137, 'n_words': 266}