The official answer is that this is currently not possible. The color
attribute, available on most components, accepts only the type of palette β that is, primary, accent, or warning.
The unofficial answer, if you really want to do this, is that it is possible (individually) if you do not mind abusing the internal APIs. For example, to get the A100 color on a button, you can add custom mixing to your theme.
// custom-button-theme.scss @import ' ~@angular /material/core/theming/all-theme'; @import ' ~@angular /material/button/_button-theme'; @mixin custom-button-theme($theme) { .mat-raised-button.a100, .mat-fab.a100, .mat-mini-fab.a100 { // _mat-button-theme-color is a mixin defined in _button-theme.scss // which applies the given property, in this case background-color // for each of the palettes - ie primary, accent and warn. // The last parameter is the hue colour to apply. @include _mat-button-theme-color($theme, 'background-color', 'A100'); } }
Then, in the main theme file, you import the custom mixin.
@import 'custom-button-theme.scss'; @include custom-button-theme($store-theme);
Your button can then use the color by adding the a100
class.
<button md-mini-fab (click)="zoomIn()" color="primary" class="a100"> <md-icon>add</md-icon> </button>
It is important to note that internal APIs can change at any time. This code has been tested with version 2.0.0-beta.2 - there is no guarantee that it will work with beta 3 when this happens.
source share