@charset "UTF-8";

///
/// Return a color from a color map. If only a color is specified, then it
/// returns a color from $su-core-colors. If a color and a color map are specified,
/// then it returns a color from the particular color map.
///
/// @name color
///
/// @param {String} $color The named key in the color map.
/// @param {Map} $colormap [$su-core-colors] The color map
///
/// @example
/// color: color($color, $su-core-colors);
/// @group mixin
@function color($color, $colormap: $su-core-colors) {
  @if $colormap == $su-core-colors {
    @if map-has-key($su-core-colors, $color) {
      $color: map-get($su-core-colors, $color);
    }
    @else {
      @error "Color does not exist in color map $su-core-colors.";
    }
  }
  @else {
    @if map-has-key($colormap, $color) {
      $color: map-get($colormap, $color);
    }
    @else {
      @error "#{$color} color does not exist in color map";
    }
  }
  @return $color;
}
