@use '../../settings' as *;
@use '../../variables' as *;
@use '../functions' as *;
@use 'breakpoints' as *;
@use 'sass:color';
@use 'sass:math';

@mixin table-variant($state, $background) {
  .table-#{$state} {
    $color: color-contrast(opaque($body-bg, $background));
    $hover-bg: color.mix($color, $background, math.percentage($table-hover-bg-factor));
    $striped-bg: color.mix($color, $background, math.percentage($table-striped-bg-factor));
    $active-bg: color.mix($color, $background, math.percentage($table-active-bg-factor));
    $table-border-color: color.mix($color, $background, math.percentage($table-border-factor));

    --table-color: #{$color};
    --table-bg: #{$background};
    --table-border-color: #{$table-border-color};
    --table-striped-bg: #{$striped-bg};
    --table-striped-color: #{color-contrast($striped-bg)};
    --table-active-bg: #{$active-bg};
    --table-active-color: #{color-contrast($active-bg)};
    --table-hover-bg: #{$hover-bg};
    --table-hover-color: #{color-contrast($hover-bg)};

    color: var(--table-color);
    border-color: var(--table-border-color);
  }
}
