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

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

问题描述

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

how to add new colors in Angular 2 material.

它在 ng2-material 文档中指定:颜色:"primary"|"accent"|"warn" 被接受 我想添加类似 "progressbarcolor" 的东西,而不是在我的自定义主题中为 angular2 材料定义的颜色.

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 {中风:$progress-circle-custom-color;}

  • /deep/ 关键字会忽略 shadow 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天全站免登陆