_functions.scss 514 字节
Newer Older
C
codecalm 已提交
1 2 3 4 5 6 7
@function alpha-attribute($color, $background) {
  $percent: alpha($color) * 100%;
  $opaque: opacify($color, 1);

  @return mix($opaque, $background, $percent);
}

8
@function theme-color-lighter($color) {
C
codecalm 已提交
9
  @return rgba($color, .2);
10 11
}

C
codecalm 已提交
12
@function str-replace($string, $search, $replace: "") {
13 14 15 16 17 18 19 20
  $index: str-index($string, $search);

  @if $index {
    @return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
  }

  @return $string;
}