In angular-material
we can define color palettes in an angular block config
as follows:
angular.module('myApp', ['ngMaterial'])
.config(function($mdThemingProvider) {
$mdThemingProvider.theme('default')
.primaryPalette('pink')
.accentPalette('orange');
});
Its quite big ...
But
I can’t find a way to handle the current color value of this palette, just to use the same colors on elements, custom or not, that do not match the list of elements supported initially.
Elements that support the theme:
- md-button
- md-checkbox
- md-progress-circle
- mdc progress linear
- md-radio-button
- md-slider
- md-switch
- md-tabs
- md-text-float
- md toolbar
refs https://material.angularjs.org/latest/Theming/02_declarative_syntax
Perhaps a little more, but of course, custom elements are not supported.
, DOM
( ), , 700
warn
default
?
API.
- service
, (-), , :
$mdTheme.getTheme('default');
, , , , .
EDIT:
- ,
( ) :
angular.module('myApp').controller('myCtrl',function($scope,$mdTheme){
var primary500 = $mdTheme.getTheme('default').getPalette('primary').getHue('500');
$scope.customStyleBorderPrimary = {
'border-bottom': 'solid 2px ' + primary500
};
}
<h4 ng-style="customStyleBorderPrimary" ng-controller="myCtrl">
My h4 title with primary border-bottom
</h4>