Sha256: cfbac411bb3bba96226c40140e7dcbdfe290034bc553943453fd05787ef5488e

Contents?: true

Size: 1.65 KB

Versions: 1

Compression:

Stored size: 1.65 KB

Contents

@mixin _assert-ascending($map, $map-name) {
  $prev-key: null;
  $prev-num: null;

  @each $key, $num in $map {
    @if $prev-num == null {
      // Do nothing
    } @else if not comparable($num, $prev-num) {
      @warn 'Potentially invalid value for #{$map-name}: This map must be in ascending order, but key "#{$key}" has value #{$num} whose unit makes it incomparable to #{$prev-num}, the value of the previous key "#{$prev-key}"!';
    } @else if $num <= $prev-num {
      @warn 'Invalid value for #{$map-name}: This map must be in ascending order, but key "#{$key}" has value #{$num} which is not greater than #{$prev-num}, the value of the previous key "#{$prev-key}"!';
    }

    $prev-key: $key;
    $prev-num: $num;
  }
}

@mixin _assert-starts-at-zero($map) {
  $first-value: nth(map-values($map), 1);

  @if $first-value != 0 {
    @warn 'First breakpoint in `$grid-breakpoints` must start at 0, but starts at #{$first-value}.';
  }
}

// Colour contrast

@function color-yiq($color) {
  $r: red($color);
  $g: green($color);
  $b: blue($color);

  $yiq: (($r * 299) + ($g * 587) + ($b * 114)) / 1000;

  @if ($yiq >= $yiq-contrasted-threshold) {
    @return $black-primary;
  } @else {
    @return $white-primary;
  }
}

// Replace `$key` with `$replace` in `$content`

@function str-replace($content, $key, $replace: '') {
  $index: str-index($content, $key);

  @if $index {
    @return str-slice($content, 1, $index - 1) + $replace + str-replace(str-slice($content, $index + str-length($key)), $key, $replace);
  } @else {
    @return $content;
  }
}

// Return a theme colour palette

@function theme-color($key: 'primary') {
  @return map-get($theme-colors, $key);
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
material-sass-4.0.0.beta3 assets/stylesheets/material/_functions.scss