Angular4更改md按钮的波纹颜色 [英] Angular4 Change md-button's ripple color

查看:70
本文介绍了Angular4更改md按钮的波纹颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Material for Angular4在网页中创建了一个md按钮.有没有办法改变涟漪效果的颜色并使之变白?我还可以更改其他纹波属性,例如纹波效果的持续时间吗?

I have created a md-button in my webpage using Material for Angular4. Is there a way to change the ripple effect's color and make it white? Can I also change other ripple properties, like the duration of the ripple effect?

推荐答案

事实证明,要更改波纹属性,应在mat-ripple-theme主题上创建一个mixin并以其应用程序的样式导入.文件:

It turned out that in order to change the ripple properties, one should create a mixin at the mat-ripple-theme and import it in their app's styles.scss file:

@import '~@angular/material/theming';

@mixin mat-ripple-theme($theme) {
  .mat-ripple-element {
    background-color: rgba(255, 255, 255, .4);
  }
}

这篇关于Angular4更改md按钮的波纹颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆