@import "~bootstrap/scss/functions";

//
// BOOTSTRAP FUNCTION OVERRIDE
// Request a theme color. Now with a variant option.
// A supplied variant can be a string from the
// element-color-levels map or a number directly from
// the color-levels map.
//
// The returned value is either a set value contained in
// the $theme-color-levels map or generated by the
// $color-level's parameters for mix(). See variables/_colors.scss
//
@function theme-color($color-name: "primary", $variant: "default") {
  $base-color: #808080 !default;
  $color-level: 500 !default;

  @if map-has-key($theme-colors, $color-name) {
    $base-color: map-get($theme-colors, $color-name);
  }

  @if type-of($variant) == "number" {
    $color-level: $variant;
  }

  @else if map-has-key($element-color-levels, $variant) {
    $color-level: map-get($element-color-levels, $variant);
  }

  @if map-has-key($theme-color-levels, "#{$color-name}-#{$color-level}") {
    @return map-get($theme-color-levels, "#{$color-name}-#{$color-level}");
  }

  @return $base-color;
}
