在角度材质中添加自定义颜色变量(2+) [英] Add custom color variables in angular material (2+)
本文介绍了在角度材质中添加自定义颜色变量(2+)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何为角度材料创建自定义"自己的颜色?
How to create "custom" own colors for angular material?
例如,引导程序类似成功
(绿色),警告
(黄色),危险
(红色)之类的颜色,位于旁边主要
(蓝色),重音
(粉红色).
For example the bootstrap like colors like success
(green), warn
(yellow), danger
(red), beside primary
(blue), accent
(pink).
换句话说:扩展Angular Material(2+)的颜色变量n以在html属性中使用它:
In other words: Extend the color variablen of Angular Material (2+) for using it in html attributes:
<button mat-raised-button color="success">Success</button>
或创建一个白色复选框,如:
or create a white checkbox like:
<mat-checkbox color="white">Check me!</mat-checkbox>
推荐答案
您无法做到.但是,如果您愿意,可以在材料的某些元素中添加"color ="whatever"属性,这会为您添加自定义类.
You can`t do it. But if you like you can add "color="whatever" attribute to some element of material and this adds custom class for you.
示例:
.whatever {
background-color: light-blue;
}
<button mat-button color="whatever"></button> // this button will have '.mat-whatever' class.
这篇关于在角度材质中添加自定义颜色变量(2+)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文