@use "../functions/color" as *;
@use "../functions/color-contrast" as *;
@use "../functions/to-rgb" as *;
@use "../mixins/color-mode" as *;
@use "../variables" as *;
@use "../variables-dark" as *;

@each $color, $value in $theme-colors {
  .text-bg-#{$color} {
    // stylelint-disable-next-line scss/at-function-named-arguments
    color: color-contrast($value) if(sass($enable-important-utilities): !important);
    // stylelint-disable-next-line scss/at-function-named-arguments
    background-color: rgba(var(--#{$prefix}#{$color}-rgb), var(--#{$prefix}bg-opacity, 1)) if(sass($enable-important-utilities): !important);
  }
}

@if $enable-dark-mode {
  @include color-mode(dark) {
    @each $color, $value in $theme-colors-dark {
      $color-rgb: to-rgb($value);
      .text-bg-#{$color} {
        // stylelint-disable-next-line scss/at-function-named-arguments
        color: color-contrast($value) if(sass($enable-important-utilities): !important);
        // stylelint-disable-next-line scss/at-function-named-arguments
        background-color: rgba($color-rgb, var(--#{$prefix}bg-opacity, 1)) if(sass($enable-important-utilities): !important);
      }
    }
  }
}
