@use '../../sass/abstracts/variables' as *;

#{$object-prefix}bar-chart {
  .o-bar-chart__bar-value {
    fill: #ffffff7a;
  }

  line {
    stroke: $white;
  }

  $colors: (
    'white': $sodra-black,
    'sodra-black': $white,
    'light-grey': $blue,
    'blue': $white,
    'green': $white,
    'yellow': $black,
    'blue-25': $blue,
    'green-25': $green,
    'yellow-25': $yellow,
  );

  @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-bar-chart__bar {
        fill: $value;
      }
      @if $color == 'white' {
        .o-bar-chart__bar-value {
          fill: $light-grey;
        }
        .o-bar-chart__text-value {
          fill: $white;
        }
      }
    }
  }
}
