@charset "UTF-8";

@use 'sass:math';
@use 'variables' as *;
@use 'colors' as *;

/* © DialogueTrainer */

@mixin nodeTypeBackgroundColor() {
  &.computer {
    background-color: $col-node-computer;
  }

  &.player {
    background-color: $col-node-player;
  }

  &.situation {
    background-color: $col-node-situation;
  }
}

// Borrowed from Bootstrap 4
// Color contrast
@function color-yiq($color) {
  $r: red($color);
  $g: green($color);
  $b: blue($color);

  $yiq: math.div(($r * 299) + ($g * 587) + ($b * 114), 1000);

  @if ($yiq >= $yiq-contrasted-threshold) {
    @return $col-text-dark;
  }
  @else {
    @return $col-text-light;
  }
}
