@use "sass:color";
@use "sass:math";
@use "../functions/color-contrast" as *;
@use "../functions/contrast-ratio" as *;
@use "../variables" as *;

// scss-docs-start table-variant
@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));
    $striped-color: color-contrast($striped-bg);
    $active-color: color-contrast($active-bg);
    $hover-color: color-contrast($hover-bg);

    --#{$prefix}table-color: #{$color};
    --#{$prefix}table-bg: #{$background};
    --#{$prefix}table-border-color: #{$table-border-color};
    --#{$prefix}table-striped-bg: #{$striped-bg};
    --#{$prefix}table-striped-color: #{$striped-color};
    --#{$prefix}table-active-bg: #{$active-bg};
    --#{$prefix}table-active-color: #{$active-color};
    --#{$prefix}table-hover-bg: #{$hover-bg};
    --#{$prefix}table-hover-color: #{$hover-color};
    color: var(--#{$prefix}table-color);
    border-color: var(--#{$prefix}table-border-color);
  }
}
// scss-docs-end table-variant
