添加新颜色以及自定义主题颜色angular2材质 [英] Add new colors along with custom theme colors angular2 material

查看:165
本文介绍了添加新颜色以及自定义主题颜色angular2材质的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Angular 2材质中添加新颜色.

how to add new colors in Angular 2 material.

它在ng2-material docs中指定:color:"primary" |" accent"|" warn被接受,我想添加除我在angular2材质的自定义主题中定义的颜色之外的其他颜色,例如" progressbarcolor.

Its specified in the ng2-material docs: color: "primary"|"accent"|"warn" are accepted i want to add something like "progressbarcolor" other than the colors defined in my custom theme for angular2 material.

例如:

 <md-progress-bar color="progressbarcolor">    </md-progress-bar>

推荐答案

您有两个选择:

  1. 自定义主题

  1. Custom theme

覆盖样式

  • 可能,不建议使用,但有时例如在将白色装载机放置在彩色按钮内时使用.

  • possible, not recommended but sometimes used for example when placing white loader inside a colored button.

<md-progress-bar class="custom-color"></md-progress-bar>

/deep/ md-progress-circle.custom-color path { stroke: $progress-circle-custom-color; }

/deep/ md-progress-circle.custom-color path { stroke: $progress-circle-custom-color; }

  • /deep/关键字会忽略影子DOM,因此请谨慎使用它,它也已弃用,但尚未删除
  • 您可以将代码放在全局样式文件中,因此不使用deep关键字
  • the /deep/ keyword ignores the shadow DOM so be careful using it, it is also deprecated but not yet removed
  • you can place the code in your global style file and therefore not use the deep keyword

这篇关于添加新颜色以及自定义主题颜色angular2材质的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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