简体   繁体   English

如何在角形材质中使用CSS类来显示文本颜色?

[英]How to use css classes for text colors in angular material?

I have some code for create css class.But it is not working correctly. 我有一些创建CSS类的代码,但是无法正常工作。 How to fix that? 如何解决?

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

Error 错误

Error: @return rgba($color, $opacity); 错误:@return rgba($ color,$ opacity); ^ Argument $color of rgba($color, $alpha) must be a color ^ rgba($color, $alpha)参数$color必须是颜色

i all ready found a solution. 我都准备找到解决方案。

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

that code create classes like .mat-blue-100 , .mat-blue-400 , .mat-blue-800 etc... 该代码创建了诸如.mat-blue-100,.mat-blue-400,.mat-blue-800等的类...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM