k.vincent k.vincent - 1 year ago 189
Sass (Sass) Question

Ho to use angular theme for all Markup elements?

Is it possible to use Angular Material theme for text and other HTML elements such text, header, links etc. ?

I would like to use something like following:

<h2 color="'primary'">Text to be colored</h2>

I have been searching and found this posting e.g. Get Material 2 theme color scheme/palette for other elements, but it seems to be too much and I also won't agree to use just
files instead of

Is there an simpler way to achieve this? For instance adding extra definition for the other elements in

Answer Source

You can use a class to set the colour in your styles:

<h2 class="app-primary">Primary</h2>

This method assumes that you have a custom theme:

$app-primary: mat-palette($mat-indigo);
// ...

.app-primary {
    color: mat-color($app-primary);


.app-primary {
    /* Insert hard-coded value here */
    color: #3F51B5;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download