[英]Angular Material theme not changing colors
I am using Angular 1.4.3 and Angular Material 0.10.0 and I am trying to use the build-in theme "green" for my app. 我正在使用Angular 1.4.3和Angular Material 0.10.0,我正在尝试为我的应用程序使用内置主题“green”。 However, even after I have done the below, the colors remain to be the default indigo: 然而,即使在我完成下面的操作之后,颜色仍然是默认的靛蓝色:
angular.module('myApp','ngMaterial'])
.config(['$mdThemingProvider', function($mdThemingProvider){
$mdThemingProvider.theme('green');
$mdThemingProvider.setDefaultTheme('green');
}])
It would be helpful if this pen http://codepen.io/anon/pen/pJYJGb could be edited to make the theme work. 如果可以编辑这个笔http://codepen.io/anon/pen/pJYJGb以使主题工作,将会很有帮助。 I could then apply the same for my project. 然后我可以为我的项目应用相同的内容。
The problem with your code is that you cannot specify the color name in the .theme('default')
. 您的代码的问题是您无法在.theme('default')
指定颜色名称.theme('default')
。
Here is the code which i have used to change the default color of my md-toolbar
, codepen . 这是我用来更改我的md-toolbar
, codepen的默认颜色的代码 。
We can change the default color of angular-material by using the themeprovider in this way : 我们可以通过这种方式使用themeprovider来更改角度材质的默认颜色:
.config(function($mdThemingProvider) {
$mdThemingProvider.theme('default')
.primaryPalette('green')
.accentPalette('orange');
});
Hope it helps. 希望能帮助到你。
Here is the code which i took from your codepen and edited it: 这是我从您的codepen中获取并编辑它的代码:
.config(['$mdThemingProvider', function($mdThemingProvider){
$mdThemingProvider.theme('default')
.primaryPalette('green');
}])
Now it is all green in color. 现在全是绿色。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.