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

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

		color: $color;
		border-color: mix($color, $background, percentage($dark-table-border-factor));
	}
}

@mixin dark-table {
	.table {
		--#{$variable-prefix}table-bg: #{$dark-table-bg};
		--#{$variable-prefix}table-accent-bg: #{$dark-table-accent-bg};
		--#{$variable-prefix}table-striped-color: #{$dark-table-striped-color};
		--#{$variable-prefix}table-striped-bg: #{$dark-table-striped-bg};
		--#{$variable-prefix}table-active-color: #{$dark-table-active-color};
		--#{$variable-prefix}table-active-bg: #{$dark-table-active-bg};
		--#{$variable-prefix}table-hover-color: #{$dark-table-hover-color};
		--#{$variable-prefix}table-hover-bg: #{$dark-table-hover-bg};

		color: $dark-table-color;
		border-color: $dark-table-border-color;

		> :not(:first-child) {
			border-top-color: $dark-table-group-separator-color;
		}
	}

	@each $color, $value in $dark-table-variants {
		@include dark-table-variant($color, $value);
	}
}
