【问题标题】:How to use css classes for text colors in angular material?如何在角度材料中使用 css 类作为文本颜色?
【发布时间】:2017-12-18 21:09:14
【问题描述】:

我有一些用于创建 css 类的代码。但它不能正常工作。如何解决?

@for $i from 1 through 100 {
  $hue : $i;
  .mat-blue-#{$i} {
    color : mat-color($mat-blue, $hue);
  }
}

错误

错误: @return rgba($color, $opacity); ^ rgba($color, $alpha) 的参数 $color 必须是颜色

【问题讨论】:

    标签: html css angularjs sass angular-material2


    【解决方案1】:

    我已经准备好找到解决方案了。

    @for $i from 100 through 1000 {
      $hue : $i;
      .mat-blue-#{$i} {
        color : map-get($mat-blue,$hue);
      }
    }
    

    该代码创建了 .mat-blue-100 、 .mat-blue-400 、 .mat-blue-800 等类...

    【讨论】:

      猜你喜欢
      • 2016-05-04
      • 2020-01-15
      • 2019-02-28
      • 2014-12-26
      • 1970-01-01
      • 2017-05-03
      • 1970-01-01
      • 2018-09-25
      • 2019-03-08
      相关资源
      最近更新 更多