@use '../../sass/abstracts/variables' as *;

#{$object-prefix}donut-chart {
  .o-donut-chart__ring {
    stroke: #ffffff7a;
  }

  .o-donut-chart__text-value {
    text-anchor: middle;
    font-size: 0.5em;
  }

  .o-donut-chart__sub-text {
    font-size: 0.2em;
    text-anchor: middle;
    fill: $sodra-black-75;
  }

  // stroke color on donut
  $colors: (
    'white': $sodra-black,
    'sodra-black': $white,
    'light-grey': $blue,
    'blue': $white,
    'green': $white,
    'yellow': $black,
    'blue-25': $blue,
    'green-25': $green,
    'yellow-25': $sodra-black,
  );

  @each $color, $value in $colors {
    @at-root .u-background-color-#{$color}
        .c-chart.u-background-color-none // if no background color is set, use the parent background color
        &,
      .c-chart.u-background-color-#{$color} & {
      .o-donut-chart__segment {
        stroke: $value;
      }
      .o-donut-chart__text-value {
        fill: $value;
      }
      @if $color == 'white' {
        .o-donut-chart__ring {
          stroke: $light-grey;
        }
      }
    }
  }
}
