<commit_before>// This Source Code Form is licensed MPL-2.0: http://mozilla.org/MPL/2.0

/** HSV (HSB) to RGBA */
@function hsv($hue, $satb, $value, $a: 1) {
  @if $satb == 0 {
    @return hsla($hue, 0, $value, $a)
  } @else if $value == 0 {
    @return hsla($hue, 0, 0, $a)
  } @else {
    $lumi: $value * (1 - ($satb / 100) / 2);
    $satl: $satb * $value / if($lumi < 50, $lumi * 2, 200 - $lumi * 2);
    @return hsla($hue, $satl, $lumi, $a);
  }
}

/** Value of window.devicePixelRatio, assigned via JS to the CSS var `--device-pixel-ratio` */
$device-pixel-ratio: var(--device-pixel-ratio);

/** Convert CSS `px` to device pixels via the CSS var `--device-pixel-ratio` */
@function dppx($n: 1) {
  @return calc(1px * #{$n} / #{$device-pixel-ratio});
}

/// Clamp `$number` between `$min` and `$max`
@function clamp($number, $min, $max) {
  @return min(max($number, $min), $max);
}

// Raises `$base` to the power of `$exponent` which must be a positive integer
@function ipow($base, $exponent) {
  @if not unitless($base) {
    @error "Error: $base must be unitless:" $base;
  }
  @if $exponent < 1 {
    @return 1;
  }
  $val: $base;
  @while $exponent > 1 {
    $val: $val * $base;
    $exponent: $exponent - 1;
  }
  @return $val;
}
@if ipow(12345, 0) != 1 {
  @error "FAIL: ipow(12345, 0):" ipow(12345, 0);
}
@if ipow(2, 8) != 256 {
  @error "FAIL: ipow(2, 8) :" ipow(2, 8);
}

/// Convert a percentage number to a factor within 0…1
@function asfactor($f) {
  @if (unit($f) == "%") {
    $f: $f / 100%;
  }
  @return $f;
}

/// Reduce luminance by a percentage<commit_msg>EBEAST: cssaux.scss: define color() for colors with relative luminance<commit_after>// This Source Code Form is licensed MPL-2.0: http://mozilla.org/MPL/2.0

/** HSV (HSB) to RGBA */
@function hsv($hue, $satb, $value, $a: 1) {
  @if $satb == 0 {
    @return hsla($hue, 0, $value, $a)
  } @else if $value == 0 {
    @return hsla($hue, 0, 0, $a)
  } @else {
    $lumi: $value * (1 - ($satb / 100) / 2);
    $satl: $satb * $value / if($lumi < 50, $lumi * 2, 200 - $lumi * 2);
    @return hsla($hue, $satl, $lumi, $a);
  }
}

/** Value of window.devicePixelRatio, assigned via JS to the CSS var `--device-pixel-ratio` */
$device-pixel-ratio: var(--device-pixel-ratio);

/** Convert CSS `px` to device pixels via the CSS var `--device-pixel-ratio` */
@function dppx($n: 1) {
  @return calc(1px * #{$n} / #{$device-pixel-ratio});
}

/// Clamp `$number` between `$min` and `$max`
@function clamp($number, $min, $max) {
  @return min(max($number, $min), $max);
}

// Raises `$base` to the power of `$exponent` which must be a positive integer
@function ipow($base, $exponent) {
  @if not unitless($base) {
    @error "Error: $base must be unitless:" $base;
  }
  @if $exponent < 1 {
    @return 1;
  }
  $val: $base;
  @while $exponent > 1 {
    $val: $val * $base;
    $exponent: $exponent - 1;
  }
  @return $val;
}
@if ipow(12345, 0) != 1 {
  @error "FAIL: ipow(12345, 0):" ipow(12345, 0);
}
@if ipow(2, 8) != 256 {
  @error "FAIL: ipow(2, 8) :" ipow(2, 8);
}

/// Convert a percentage number to a factor within 0…1
@function asfactor($f) {
  @if (unit($f) == "%") {
    $f: $f / 100%;
  }
  @return $f;
}

/// Construct color from hue and relative luminance
/// [WCAG relative luminance](https://www.w3.org/TR/WCAG20/#relativeluminancedef)
@function color($h, $l: 50%, $s: 100%) {
  $base: chromatic-hsv($h, asfactor($s), 1);
  @return chromatic-color-luminance($base, asfactor($l));
}

/// Reduce luminance by a percentage
{'fraction_non_alphanumeric': 0.21, 'fraction_numerical': 0.03742857142857143, 'mean_word_length': 3.197841726618705, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, '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': '6673922', 'n_tokens_mistral': 1542, 'n_tokens_neox': 1417, 'n_words': 410}